Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[SOLVED] Is there a bug in ogre gorge gouger?

Hi I got problem with this level, everything is ok untill my hero should build “fence” but he doesnt
here is my code…


while(hero.time < 20|| hero.gold<60 ) {
    // Zbierz monety.
    hero.say("Powinienem podnieś monetę.");
var item = hero.findNearestItem();
if (item) {
    hero.moveXY(item.pos.x, item.pos.y);
if (hero.time>20&hero.gold>60) {
    break;

}
}
}

while(hero.pos.x > 16) {
    // Ucieknij za płot.
    hero.say("Powinienem się wycofać.");
    hero.moveXY(16, 38);
 hero.buildXY("fence", 21,38);
}
// hero.buildTypes;["fence",21,38];

type or paste code here

What equipment are you using

Here is your code properly formatted:

while (hero.time < 20 || hero.gold < 60) {
    // Zbierz monety.
    hero.say("Powinienem podnieś monetę.");
    var item = hero.findNearestItem();
    if (item) {
        hero.moveXY(item.pos.x, item.pos.y);
        if (hero.time > 20 & hero.gold > 60) {
            break;
        }
    }
}
while (hero.pos.x > 16) {
    // Ucieknij za płot.
    hero.say("Powinienem się wycofać.");
    hero.moveXY(16, 38);
    hero.buildXY("fence", 21, 38);
}

It runs fine for me, but extremely slow. I would recommend removing the ‘hero.say’ statements…they just slow him down. I would also recommend only testing for time in your first while loop and in your inner (second) if statement, do the opposite…only test for gold. (Besides, you are missing an &)

is it bad seed?(@dedreous? )

Can’t completely rule that out…but the code can certainly be ‘tidied’ up a tad.

ok thanks for clarifying @dedreous

there, is an error in last line ```
hero.buildXY(“fence”, 21, 38);

If you copy quotation marks from here, they tend to end up as the fancy ones, which do cause errors in the game. Just replace the quotes with proper " symbols.

quotation marks are ok and it still doesnt work

Post your code again, directly from the game, please.

while (hero.time < 20 || hero.gold < 60) {
    // Zbierz monety.
    hero.say("Powinienem podnieś monetę.");
    var item = hero.findNearestItem();
    if (item) {
        hero.moveXY(item.pos.x, item.pos.y);
        if (hero.time > 20 & hero.gold > 60) {
            break;
        }
    }
}
while (hero.pos.x > 16) {
    // Ucieknij za płot.
    hero.say("Powinienem się wycofać.");
    hero.moveXY(16, 38);
    hero.buildXY("fence", 21, 38);
}

hmm i dont see anything wrong with fence part

maybe it is a bug :frowning: coz it should work

It’s not a bug…if it were, it would break for everyone. I copied you code and the only change I made was to comment out the two ‘say’ lines and I got this:

yo are right maybe it is a bug

It’s not a bug. @Zambi25, are you able to try it in a different browser? Also, post a screenshot of your end game…just like what I posted above.

ok idont understand so bye

Which hammer do you have equipped? This one works just fine: