Hi,
I really don’t get what’s the problem with this code and would appreciate any help.
When I execute this code, I collect 8 to 15 coins and claim “4” to Naria who calls me a liar ( true )
If I delete the last 3 lines, character collects 8 to 15 coins, nothing more happens.
Any ideas ?
decoysBuilt = 0
self.gold = 0
loop:
item = self.findNearestItem()
# Loot the coin!
itemX = item.pos.x
itemY = item.pos.y
self.moveXY(itemX, itemY)
# Each decoy costs 25 gold. Use the Quartz Sense Stone
# to know when you have more than 25 gold with self.gold.
if self.gold >= 25:
self.buildXY(“decoy”, self.pos.x - 5, self.pos.y)
# Keep a count of decoys you built as you go along.
decoysBuilt = decoysBuilt +1
# Break out of the loop when you have built 4.
elif decoysBuilt == 4:
break
self.moveXY(14, 36)
self.say(“4”)