I have spent the past 2 hours on this level and I can not figure out what I am doing wrong. I have tried multiple variations of code and don’t understand why none are working.
decoysBuilt = 0
loop:
item = self.findNearestItem()
# Loot the coin!
self.moveXY(item.pos.x, item.pos.y)
# Each decoy costs 25 gold. Use the Quartz Sense Stone
# to know when you have more than 25 gold with self.gold.
Totalgold = Totalgold + item.value
# Keep a count of decoys you built as you go along.
D = decoysBuilt
if Totalgold > 25:
self.buildXY("decoy", self.pos.x, self.pos.y)
if D = 1:
break
self.say("Done building decoys!")
the above is one sample and when I run it I just keep collecting gold and never build any decoys.
loop:
item = self.findNearestItem()
totalgold = self.gold + item.value
if item:
self.moveXY(item.pos.x, item.pos.y)
if totalgold > 25:
self.buildXY("decoy", self.pos.x, self.pos.y)
d = self.decoysBuilt
if d = 2:
break
self.say("done")
the one above will build one decoy and then just stop
decoysBuilt = 0
loop:
coin = self.findNearestItem()
totalgold = total.gold + coin.value
if coin:
self.moveXY(coin.pos.x, coin.pos.y)
if totalgold > 25:
self.buildXY("decoy", self.pos.x, self.pos.y)
self.decoysBuilt + 1
if d = 1:
else:
break
self.say("done")
the above one does nothing. I am at a complete loss, please can someone tell me what I am missing and why these are all failing? I could just do it the easy way and set it to collect coins for like a minute then build 4 decoys and just have him say 4, but I really want to learn how to do this correctly