Decoy Drill Help; It doesn't stop building decoys

This is my code

    item = self.findNearest(self.findItems())
    if < 25 :
        self.moveXY(item.pos.x, item.pos.y)
        self.buildXY("decoy", self.pos.x - 2, self.pos.y -2)
        decoysBuilt = decoysBuilt+1
    if decoysBuilt >= 4:
        self.moveXY(14, 36)
        self.say("Done building decoys!")


You have to break out of the loop before you go to tell Naria your amount of decoys.

That’s what I tried, and it never stops.
Here’s my code.

We are field testing a new battle unit: the decoy.

Build 4 decoys, then report the total to Naria.

decoysBuilt = 0
item = self.findNearestItem()
if item:
pos = item.pos
x = pos.x
y = pos.y
self.moveXY(x, y)
# Each decoy costs 25 gold.
# Know when you have more than 25 gold with
if >= 25:
newX = self.pos.x - 5
newY = self.pos.y
self.buildXY(“decoy”, newX, newY)

    # Keep a count of decoys you built as you go along.

if decoysBuilt == 4:
    # Break out of the loop when you have built 4.

self.say(“Done building decoys!”)
self.moveXY(14, 36)

Go to Naria and say how many decoys you built.

You need to iterate decoysBuilt, either with decoysBuilt = decoysBuilt + 1 or decoysBuilt += 1. I will leave it to you to figure out where it goes.

Also, I see you only joined three days ago. Before you post again you should probably read the FAQ and learn how to properly post your code. I’m sure someone will come along and fix it this time, but you should know it for the future.

Where would the FAQ be? And second, the code I typed is still causing the sprite to build more than one or less.

Here’s the FAQ. You can also find it by opening the “hamburger” menu (the icon that has three horizontal lines near the top-right of the screen) and clicking “FAQ”.

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);
    # Each decoy costs 25 gold.
    # If is greater than or equal to 25:
    if >= 25:
        # buildXY a "decoy"
        hero.buildXY("decoy", 36, 30)
        # Add 1 to the decoysBuilt count.
        decoysBuilt == decoysBuilt + 1
        if decoysBuilt == 4:
            # Break out of the loop when you have built 4.
hero.say("Done building decoys!")
hero.moveXY(14, 36)
# Say how many decoys you built.
hero.say("I built 4 decoys")