Help! Can't make the hero move to flags in Tactical timing

I made my code to make my hero go to flags but he wouldn’t go there.

do you have the flag item equipped and how are you calling the flag logic?

,

var enemy = hero.findNearestEnemy();
var flag = this.findFlag();

while(true) {
if (flag) {
hero.moveXY(flag);
hero.pickUpFlag(flag);
}else if(enemy) {
hero.attack(enemy);
}
,
Sorry if it’s not posted according to the FAQ, I’m still working on how too use the code thing. BTW I have the basic flag.

@TheEpicSoldierReborn just highlight your source code and use the “Preformatted text” button to fix it.

also its the ` below the ~ character (US keyboard) and not the ' below the " character.

take a look at this again.

hero.moveXY(x ,y); wants two arguments an x-coordinate and a y-coordinate.

So the question is “Does a flag have and x and y coordinate and how would you access them?”

Sorry the moveXY command was just trying to get my hero to move the flag.

@TheEpicSoldierReborn I am not sure what you mean. Are you ok now with the code or did you still need help?

Fixed it! I found out the solution!

This topic is officially solved.