Long Road Please Help Me Solve This!


#1

Here is my code in “Long Road”. It works fine, just that I always seem to run out of time or die. I even have the Enameled Dragonplate, the Enameled Dragonplate helmet, Softened Leather Boots and even Deflector, but I still run out of time, or die before I reach the end. Can anybody help me?

function fetchPotions(event) {
    while(true) {
        var item = hero.findNearest(hero.findItems());
        pet.fetch(item);
        break;
    }
}

while(true) {
    var X = hero.pos.x;
    var health = hero.health;
    if (health < hero.maxHealth/3) {
        fetchPotions(pet.spawn);
    }
    else {
        hero.moveXY(X+5.5555555555, 35);
    }
}

#2

You need to assign “fetchPotions” function on the pet’s event “spawn” (and remove break)


#3

Thank you very much.


#4

Does anyone know more about how to assign “fetchPotions” to the pet’s event to “spawn”? I’m stuck on this as well.

tried:
pet.spawn = “fetchPotions()”;


#5

That level is placed after levels which explain it. Have you played them? “Go fetch” “Forest Jogging” “Guard dog”.


#6

I did but I was kind of all over the place before I notice you’ll run into these sort of problems not going in the prompt order lol. Thank you Bryukh! the solution was on one of those levels for anyone having trouble :wink:


#7

Np. As I can see “Forest Jogging” is placed after “Long Road” :frowning:


#8

Hello ;

Is it possible to help us for the same level, but for Python?

The link for our question is:

Thanks for your help


#9

Strangely, we solved it finally !

Thanks for the help.

:slight_smile :slight_smile: