Please do not be impatient, but your problem is that you do not have anything to define else; You did code else, but you are not defining what else is for. Also, could you please paste your code to your post so it is easier for me to see?
O.K. thx!!!
while (true) {
var evilstone = hero.findNearestItem();
if (evilstone) {
if (evilstone.pos.x==34) {
hero.moveXY(46, 22);
} else {
hero.moveXY(46, 22);
}
hero.moveXY(40, 22);
} else {
hero.moveXY(40, 22);
}
hero.moveXY(34, 22);
} else {
hero.moveXY(34, 22);
}
}
Oh, also read the FAQ to post your code correctly.
For example,
while (true) {
var evilstone = hero.findNearestItem();
if (evilstone) {
if (evilstone.pos.x==34) {
hero.moveXY(46, 22);
} else {
hero.moveXY(46, 22);
}
hero.moveXY(40, 22);
} else {
hero.moveXY(40, 22);
}
hero.moveXY(34, 22);
} else {
hero.moveXY(34, 22);
}
}
just looks like you didn’t indent correctly.
Where is the FAQs???
In the top right corner, you will see three horizontal bars. Click on them, and you will see the FAQ with a new sign to the right of it.
O.K. Thx!!!
Looks like the “new” was taken off for me.
I just tried your code. It did not work.
Help!!!
No, that was your code. I just used an example of what happens when you don’t read the FAQ and don’t know what to do.
Oh. You are mean!!!
BTW, I don’'t code JS
But I can understand a little bit; I also code Java.
Oh. Thx anyway. This is my last post due to the first day thing. I can still edit this post and tell you stuff.
The problem with your code is that you need to define what else is for. If you keep saying that else of else, the code messes up.
You need the "elif"s, BTW.
Ok. I got it. (20 chars)
Sorry for being impolite.