Trying to get the hero to just go grab the gold first so I don’t have any lines for actually building decoys yet.
However, she seems to get stuck and not move any further. I’m wondering if I missed anything…if I try this.say(gold); it will respond with an error of “Say what?”
Any ideas what I did wrong in my code?
Thanks!
// Build 4 decoys.
// Each decoy costs 25 gold.
// Check this.gold to know when you have enough to build one.
// Keep a count of decoys you built as you go along.
// Break out of the loop when you have built 4.
var decoysBuilt = 0;
var gold = 0;
loop{
while (gold < 101) {
item = this.findNearestItem();
this.say(item);
if (item) {
position = item.pos;
x = position.x;
y = position.y;
this.moveXY(x, y);
gold = this.gold;
}
}
}
this.say("Done building decoys!");
// Go to the banker and report how many decoys you built.