Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Help with Cursed Wonderglade [javascript]


I did the code but it keeps giving me an error and I can’t find what is wrong with my code? Please help me identify the mistake

while (true) {
// Find the nearest item.
// Collect it (if it exists) only if its type isn’t “gem”.
var item = hero.findNearest(hero.findItems());
if (item & item.type!=“gem”){
this.moveXY(item.pos.x, item.pos.y);
// Find the nearest enemy.
// Attack it if it exists and its type isn’t “burl”.
var nearest = hero.findNearest(hero.findEnemies());
if (nearest & nearest.type!=“burl”){
hero.cast(“drain-life”, nearest);




[Post must be at least 20 characters]


thank you so much! it worked. I switched from python to java and still learning


mine is python but i still need help i dont know whats wrong


You need to check the existence of an item and enemies.