I am having trouble with Decoy Drill. I am collecting way too much gold before building a decoy. If I take out the pice of code that says totalGold=0; after building a decoy, my guy simply stops.
Thoughts?
var decoysBuilt = 0;
var totalGold = 0;
loop {
var coin = this.findNearestItem();
this.moveXY(coin.pos.x, coin.pos.y);
var value = coin.value;
totalGold = totalGold + value;
if (totalGold >= 25) {
this.buildXY("decoy", this.pos.x, this.pos.y);
decoysBuilt = decoysBuilt + 1;
totalGold=0;
}
if (decoysBuilt >= 4) {
break;
}
}
this.say("Done building decoys!");
// Go to Naria and say how many decoys you built.
this.moveXY(14, 36);
this.say("I have built "+decoysBuilt+" decoys.");