Need help at the lvl "Long Road" with Python

I can’t find what I’m doing wrong. Sometimes there was written that item = pet.findNearestItem() is written wrong, that I should type in pet.findNearestItem()… which was written the same. Only without the () there is no error, but it still doesn’t work. What do I need to change? Help :confused:

1 Like

Just add the () back

1 Like

you added “pass” too early.:sunglasses:

1 Like

Tried this already … always this error. :worried:
Also when pass is under while True or if…

1 Like

Try item = pet.findNearestByType("item") or potion = pet.findNearestByType("potion")

Move to the right.

Complete this function:

def onSpawn(event):
# Inside a while-true while True:
while True:

    # Use hero.findNearestItem()
    item = hero.findNearestItem()
    # If there's an item:
    if item:
        # Use pet.fetch(item) to fetch the item.

Use pet.on() to assign onSpawn to the “spawn” event

pet.on(“spawn” , onSpawn)
hero.moveXY(78, 35)

This is my code in python

1 Like

Briana, do you need help with this level? If so, please post your code, properly formatted. This link will show you how: [Essentials] How To Post/Format Your Code Correctly

It worked for me!!!
Great job!!!

1 Like