Wishing well not working!


#1
var less = 'Nimis';
var more = 'Non satis';
var requiredGold = 104;
function sumCoinValues(coins) {
    var i = 0;
    var total = 0;
    while (i < coins.length) {
        total += coins[i].value;
        i++;
    }
    return total;
}
while (true) {
    var items = hero.findItems();
    var goldAmount = sumCoinValues(items);
    if (items.length !== 0) {
        if (goldAmount < 104) {
            hero.say('Non satis');
        }
        if (goldAmount > 104) {
            hero.say('Nimis');
        }
        if (goldAmount == 104) {
            hero.say(goldAmount);
            loop {
                var coins = hero.findItems();                
                var index = 0;
                var nearestDistance = 9999;
                var nearest = coin;
                while (index < coins.length) {
                    var coin = coins[index];
                    index += 1;
                    var distance = hero.distanceTo(coin);
                    if (distance < nearestDistance) {
                        nearest = coin;
                        nearestDistance = distance;
                    }
                }
                hero.moveXY(nearest.pos.x, nearest.pos.y);                
            }
        }
    }
}

My hero waits until the value of the coins is 104 and then collects them all in an efficient manner, well before the time runs out, but the level won’t let me pass and keeps saying I’ve run out of time. Is this is a bug or am I missing something?


#2

It’s weird. I tried your solution and got “success”. Could you look at the dev console? Maybe some errors there.


#3

I’m pleased it’s working for you, suggests my code is ok. Still not working this end and nothing in the Dev console as far as I can see. Thanks for the reply.


#4

Do you see something like this?

|Anhur's Krieger| Hero Placeholder 104

Could you give screenshots of the level after you collect all coins and dev console screenshots (there is some log information)


#5

Does this help? It says

|Allah's Krieger| Hero Placeholder 104

#6

Hello jackets82 (that’s a lot of jackets!)

Email team@codecombat.com with your username so we can load up your session and see what you’re seeing.


#7

I’m still searching the problem. It’s really weird. Could you show which equipment do you use? A screenshot will be enough.


#8

Thanks for taking the time to keep looking at this.


#9

Thanks! It helped. At least I reproduced that bug. You didn’t equip any “boss star”. Of course, you don’t have to do it and it’s definitely a bug, but now I know where to search. I will write you when I solve it.


#10

I hope I fixed it. Could you try it?


#11

I don’t know what “boss star” is!


#12

Don’t worry, now level should work without it.


#13

Still no joy :frowning:


#14

Hm?
Try the direct link http://direct.codecombat.com/play/level/wishing-well


#15

Maybe get the ring of speed or speedy stuff