Javascript - Sarven Desert - Stranded in the Dunes


#1

I think I broke it … what did I do…the site barely loads my code and it loooks like I am cheating the level somehow…

while (true) {
    var enemy = hero.findNearestEnemy();
    var item = hero.findNearestItem();
    if (enemy) {
        var distance = hero.distanceTo(enemy);
        if (distance < 30) {
            if (hero.isReady("bash")) {
                hero.bash(enemy);
            } else if (hero.isReady("cleave")) {
                hero.cleave(enemy);
            } else {
                hero.attack(enemy);
            }
        }
    } else {
        if (!enemy && item && item.type == "potion") {
    hero.moveXY(item.pos.x, item.pos.y);
        } else if (!enemy && !item) {
            hero.moveXY(119, 32);
            hero.moveXY(82, 29);
        }
    }
}

#2

What do you mean by “the site barely loads my code”?

Also how are you “cheating”?


#3

It told me it was a loop.

It gave me credit for completion and i don’t believe I’ve completed the level?


#4

Oh and it takes 30+ seconds for the page to load


#5

well, I think that the page loading is on your end, you might have a slow/outdated computer. If you don’t think that you have beaten the level, then you could watch as your goals are checked off, and report any bugs if it gives you credit and it doesn’t work. :slight_smile: