Can't Read Protected Property


This code was added in automatically, yet it states that something is wrong with it There is no bug in the code, so what’s wrong with it?

Never mind, I understand now :slight_smile:

I don’t understand, what’s the problem? I have that exact same error right now.

You probably don’t have the method that you are trying to execute. For example, the findNearestItem method is not available if your glasses are too good, you then need hero.findNearest(hero.findItems()). Similarly for findNearestFriend / Enemy. You also won’t have a buildXY method if you are not equipping a hammer.

I upgraded or / downgraded my glasses which than gave me “protected property : move” I tried the same thing with the boots, but the problem was not fixed.

// Check the guide for more details.
var item = hero.findNearest(hero.findItems());
if (item && hero.isPathClear(hero.pos, item.pos)) {
    hero.move(item.pos);

}
else {
hero.move({x: hero.pos.x, y: hero.pos.y + 5});
}

Does there has to be an item, or will he constantly move until an item is found? Could that maybe be the issue?

I have constantly switched between the two key words “this” and “hero” in order to fix the protected property:move error.

@gat Are you getting an error about the move property? If so, you need to equip boots that provide the move method, that is, Compound Boots or above.

I currently have soften leather boots equipped on my wizard. And the boots say,“skills granted moveXY”.

moveXY and move are two different methods. :slight_smile:

ohhh I didn’t see there was a third move as in this.move. I kept only seeing this.moveXY and this.moveDown, up, left, and right etc The fine boots did it thank you. :slight_smile: