Before submitting to gitHub, I’d like to check first here. I decided to make two helper functions
function walkTo(positioned) {
hero.moveXY(positioned.pos.x, positioned.pos.y);
}
function ifCollect() {
var item = hero.findNearestItem();
if (item)
walkTo(item);
}
The first works directly in program, however the second one - ifCollect - raises a strange error on the “walkTo(item)” line:
Cannot read property ‘value’ of undefined
I’m pretty sure this looks like a bug but I’d like to check first.