Cannot redefine property: say


#1

Dear code combat,
I followed the tutorial completely. Even so my code is still not working.
Here it is.

loop {
var flag = this.findFlag();
if (flag) {
this.pickUpFlag(flag);
} else {
var item = this.findNearestItem();
if (item) {
var position = item.pos;
var x = position.x;
var y = position.y;
this.moveXY(x, y);
}
}
}

It says that it can not redefine property: say. Please contact me. I can not understand the problem.

Thank you,
Paul


#2

Help us help you…

  • Format and indent your code. It helps, really!
  • Wrap your code in ``` (line above and line below)

Doing both of these makes your code look like this:

loop {
    var flag = this.findFlag();
    if (flag) {
        this.pickUpFlag(flag); 
    } else {
        var item = this.findNearestItem();
        if (item) {
            var position = item.pos;
            var x = position.x;
            var y = position.y;
            this.moveXY(x, y);
        }
    }
}

This is definitely not an issue with your code. Have you tried exiting the level and replaying it? Some issues are resolved quite simply by this. If this doesn’t work, one of the mods might have a suggestion? Of course, the guru is @nick.