mayro
1
Please help. So triggered, might stop dealing nut.
‘’’
while(true) {
var decoysBuilt = 0;
var coin = hero.findNearestItem();
if(coin) {
hero.moveXY(coin.pos.x, coin.pos.y);
}
if (hero.gold >= 25) {
hero.buildXY(“decoy”, hero.pos.x, hero.pos.y);
decoysBuilt += 1;
}
if (decoysBuilt == 4) {
break;
}
}
hero.say(“Done building decoys!”);
hero.moveXY(14, 36);
hero.say(decoysBuilt);
‘’’
mayro
2
Hold Up, broke some forum rules. What I mean is:
while(true) {
var decoysBuilt = 0;
var coin = hero.findNearestItem();
if(coin) {
hero.moveXY(coin.pos.x, coin.pos.y);
}
if (hero.gold >= 25) {
hero.buildXY("decoy", hero.pos.x, hero.pos.y);
decoysBuilt += 1;
}
if (decoysBuilt == 4) {
break;
}
}
hero.say("Done building decoys!");
hero.moveXY(14, 36);
hero.say(decoysBuilt);
For some reason, my variable isn’t increasing. Why?
i recommand this instead:
mod edit: removed.
Hi @mayro, welcome to the CodeCombat Discourse! 
Look at where you’ve put this line:
It’s inside the loop…
Danny