[SOLVED] Decoy Drill it won't stop building decoys

I have a problem. Every time I try, it doesn’t stop. This is my code:

decoysBuilt = 0
while True:
    coin = hero.findNearestItem()
    
    if coin:
        # Collect the coin!
        hero.moveXY(coin.pos.x, coin.pos.y);
        pass
    # Each decoy costs 25 gold.
    # If hero.gold is greater than or equal to 25:
    if hero.gold >= 25:
        # buildXY a "decoy"
        hero.buildXY("decoy", 36, 30)
        hero.wait(4)
        # Add 1 to the decoysBuilt count.
        decoysBuilt == 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)
# Say how many decoys you built.
hero.say("I built 4 decoys")

PLEASE HELP ME !!!

Nevermind. I solved it!

help pls i am stuck and any help will be apreciated

If you want help you need to post your code. Please also format it so we can’t see the indents. Press the button to the left of the heart (over the big gap) and paste your code directly from CodeCombat into the gap inbetween the two ```.
Please also explain your issue.
Danny

decoysBuilt = 0
while True:
    coin = hero.findNearestItem()
    
    if coin:
        # Collect the coin!
        hero.moveXY(coin.pos.x, coin.pos.y);
        pass
    # Each decoy costs 25 gold.
    # If hero.gold is greater than or equal to 25
    if hero.gold >= 25:
        # buildXY a "decoy"
        hero.buildXY("decoy", 36, 30)
        hero.shield(4)
        # Add 1 to the decoysBuilt count.
        decoysBuilt == 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)
# Say how many decoys you built.
hero.say("I built 4 decoys")

my problem is the title of the chat

You have to use assign, not equal to.

got it now thanks! (20 chars)

[SOLVED] ( 20 chars)

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