I can not understand what is wrong, collecting bait, but gathering process continues, why not appropriate and does not say that gathered 4 bait.
loop {
var item = this.findNearestItem();
if(item) {
var Gold = item.pos;
var x = Gold.x;
var y = Gold.y;
this.moveXY(x, y);
}
var totalGold = this.gold;
if (totalGold >= 25) {
this.buildXY("decoy", 7, 30);
}
var decoysBuilt = this.decoy;
if( decoysBuilt >= 4)
{
break;
}
}
this.moveXY(14, 36);
this.say("decoy collected!");
this.say("4 pieces!");