[Solved] Passing through help!

My wolf won’t move at all. Here’s my code:
while True:
item = hero.findNearestItem()
if item:
# If item.type IS NOT EQUAL TO "gem"
if item.type != “gem”:
# Then follow your pet wolf.
hero.moveXY(pet.pos.x, pet.pos.y)
# Else:
else:
if item == “gem”:
# Move to the gem’s position.
hero.moveXY(item.pos.x, item.pos.y)

My wolf just moved but my hero won’t pick up any gems

It’s very hard to read your code because you didn’t format it using the </> button. From now on please do that and it will appear here exactly as it does in the game.

while True:
    item = hero.findNearestItem()
    if item:
    # If item.type IS NOT EQUAL TO "gem"
        if item.type != “gem”:
        # Then follow your pet wolf.
        hero.moveXY(pet.pos.x, pet.pos.y)
    # Else:
    else:
        if item == “gem”:
        # Move to the gem’s position.
        hero.moveXY(item.pos.x, item.pos.y)

Look at how you locate item in the “if” statement. Then look at how you locate item in the “else” statement. The first is correct. The second is not.

I’m still having a little trouble even with the correct coding

nevermind got it!!! thanks

doesnt work for me when i use this

Note that this was not working code. We don’t post working code here. It has comments about what’s wrong with it in the post. It must be corrected to work.