Decoy drill help?


#1
# We are field testing a new battle unit: the decoy.
# Build 4 decoys, then report the total to Naria.

decoysBuilt = 0
while True:
    coin = hero.findNearestItem()
    
    if coin:
        # Loot the coin!
        hero.moveXY(coin.pos.x, coin.pos.y)
        pass
    # Each decoy costs 25 gold.
    # Know when you have more than 25 gold with hero.gold
    if hero.gold >= 25:
        hero.buildXY("decoy", hero.pos.x , hero.pos.y)
    
        # Keep a count of decoys you built as you go along.
    decoysBuilt += 1
    if decoysBuilt == 4:
        # Break out of the loop when you have built 4.
        break
        pass
    
hero.say("Done building decoys!")
hero.moveXY(14, 36)
# Go to Naria and say how many decoys you built.
hero.say(decoysBuilt)

So thats my code for it. I think that its not checking the gold for some reason but I can’t figure out why…I’ve read the hints and probably just something I’m overlooking again…


#2

Click the </> or surround your code in triple back ticks: ( ` ) so it properly formats with the indentation.