An error when there is no error

So i’ve literally just copied the code from the heroes is path clear and I receive the error Line 10: tmp8[tmp9] is not a function. My code looks like this
. . .
var item = this.findNearest(this.findItems());
if (item && this.isPathClear(this.pos, item.pos)) {
this.move(item.pos);
}
else { this.move({x: this.pos.x, y: this.pos.y +5});
}

Which level did you paste your code into?

Stranded in the dunes, trying to unlock that giant muscular character.

Compare what it said to do in the previous level to the level that your on now. If what it says is different then edit your code.

Okay, so I looked at the previous level which was saving time, but that didn’t help what so ever because they are asking entirely different things and it was not required to use this.isPathClear. Anyway so my character for some reason will not attack enemies whom confront him, he just keeps walking to the right.

loop {
var enemy = this.findNearestEnemy();
// if no enemy continue walking
if (enemy) {
this.attack(enemy);
} else {
this.moveXY(this.pos.x + 10, this.pos.y);
}

}

and this code looks incredibly logical and set up in the proper order. But yet he still continues to just walk to the right.

I’m sorry, maybe its your computer?

Same thing here, I’ve copied a code word for word, compared it with other codes, yet it doesn’t work. I’m in Copperfield Meadows in Backwood Forest, and one of the sample codes is incorrect, it’s item= self.findNearestItem()

It’s really been annoying me now, I been trying for several hours to make this game work, but the stupid code warning has been cropping up in nearly every level, even if I’ve proved it’s correct.

I wish this could be fixed.

Can you please post your code in triple backticks ( ` ) so we can see what may be the problem?

I’ve done that.
Thanks!

I meant copy your code from the game and paste it here in the forums so we can see it to help.

Sorry,

while True:
    flag = hero.findFlag()
    if flag:
        pass  # pass is a placeholder, it has no effect.
        # Pick up the flag.
        self.pickUpFlag(flag)
    else:
        # Automatically move to the nearest item you see.
         item = hero.findNearestItems()''' This one's the wrong one
        if item:
            position = item.pos
            x = position.x
            y = position.y
            hero.moveXY(x, y)

And what glasses are you wearing?

hardened steel glasses.

The problem is you do not have the findNearestItem() API. Your glasses have the following:

findItems
findNearest
findEnemies
isPathClear
findByType
distanceTo

Since you upgraded your glasses too much, you’ll want to use hero.findNearest(hero.findItems()) to replace every hero.findNearestItem() you see. Then you won’t see the error anymore. Or, downgrade your glasses to a pair that has hero.findNearestItem().

It works now!
I haven’t degraded my glasses, I used the one you suggested; item = hero.findNearest(hero.findItems())

Hello!

I have a problem at the same level (Copper Meadows).
My code is:

while True:
    flag = hero.findFlag()
    if flag:
        pass # pass is a placeholder, it has no effect.
        # Pick up the flag.
        hero.pickUpFlag(flag)
    else:
        # Automatically move to the nearest item you see.
        item = hero.findNearestItem()
        if item:
            position = item.pos
            x = position.x
            y = position.y
            hero.moveXY(x, y)

Please, help me! My hero doesn’t move to the flags or starts to move toward the flags and items but stops. I have error message for the line 5: "Code never finished. Its either really slow or has an infinite loop."
I have wooden glasses and softened leather boots.indent preformatted text by 4 spaces

try this code @mamintix

don't post solutions