var flagG = hero.findFlag("green");
var flagB = hero.findFlag("black");
var flag = hero.findFlag("green" || "black);
function pickUp(flag) {
var item = hero.findNearestItem();
var position = item.pos;
var x = position.x;
var y = position.y;
var flagV = hero.findFlag(flagG);
var flagB = hero.findFlag(FalgB);
if (flagG) {
hero.moveXY(x, y);
hero.pickUpFlag(flagG);
}
if (flagB) {
hero.moveXY(x, y);
hero.pickUpFlag(flagB);
}
}
var enemy = hero.findNearestEnemy();
while (true) {
pickUp(flag);
if (flagG)
pickUp(flag);
if (enemy) {
hero.attack(enemy);
}
if (flagB) {
pickUp(flag);
var ready = hero.isReady("cleave");
if (enemy) {
if (ready) {
hero.cleave(enemy);
}
}
}
}
The bad code isnāt in the line showing, but that line of code is where the error creates a problem. You didnāt close the quotations after black at the top. So when you call pickUp(flag), it canāt find the closing quotations which carries over into the next line of code. In fact, your posted code shows the error by making everything red.
try using a builders hammer and while loop it: so that u always keep building the fire traps then when orgres come from the entrences then KABLOOM! if you ever need help u can use flags to command your hero to move to the healers spot and just let your soldiers do the dirty work, TIP: dont go attack thoktar
Wrong punctuation. ; instead of :. Change ; to :.[quote=āUser1.1, post:1, topic:20005, full:trueā]
var flagG = hero.findFlag("green");
var flagB = hero.findFlag("black");
var flag = hero.findFlag("green" || "black);
function pickUp(flag) {
var item = hero.findNearestItem();
var position = item.pos;
var x = position.x;
var y = position.y;
var flagV = hero.findFlag(flagG);
var flagB = hero.findFlag(FalgB);
if (flagG) {
hero.moveXY(x, y);
hero.pickUpFlag(flagG);
}
if (flagB) {
hero.moveXY(x, y);
hero.pickUpFlag(flagB);
}
}
var enemy = hero.findNearestEnemy();
while (true) {
pickUp(flag);
if (flagG)
pickUp(flag);
if (enemy) {
hero.attack(enemy);
}
if (flagB) {
pickUp(flag);
var ready = hero.isReady("cleave");
if (enemy) {
if (ready) {
hero.cleave(enemy);
}
}
}
}