CodeCombat level - Go Fetch[SOLVED]

How do I get past Go Fetch in CodeCombat?! HELP!

What is your code? (20 chars)

My code:

# You've been caught in a burl trap!
# Send your pet to fetch the health potions!

def goFetch():
    # You can use loops in a handler function.
    while True:
        potion = hero.findNearestItem()
        if potion:
            # Use pet.fetch to fetch the potion.
            pet.fetch("potion")
            pass

# When your pet is summoned, it triggers a "spawn" event.
# This tells your pet to run the goFetch function at the start of the level:
pet.on("spawn", goFetch)

What is your equipment for the level? That might be why.

Programmation II, Wooden Glasses, Sundial Wristwatch, Workers Gloves, Long Sword, Tarnished Bronze Breastplate, Bronze Shield, Leather Boots, and Cougar.

use:

potion = pet.findNearestByType("potion")

It still doesn’t work! My pet still says "I can’t carry that!"

actulaly forget that

Remove the brackets and you’ll be good. that’s all you need to do

What are the brackets? These? ()

sorry i meant the quotes

to change it to:

pet.fetch(potion)

Thank You! It worked!

1 Like

ok! great! could you change hte title to say solved and also mark the soution box under whivhever post helped most

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.