Unknown transpile error (stranded in the dunes JS)

code



function jumpTo(position, fast=true) {
    if (hero.isReady("jump")) {
        hero.jumpTo(position);
    }
    else {
        hero.move(position);
    }
}

function summon() {
    if (hero.costOf("soldier")) {
        hero.summon("soldier");
    }
}

function command(enemy) {
    var friends = hero.findFriends();
    for (var friend in friends) {
        if (enemy && friend.type === "soldier") {
            hero.command(friend, "attack", enemy);
        }
    }
}

function attack(enemy) {
    while(true) {
        
        if (enemy && enemy.type !== "sand-yak") {
            if (hero.isReady("power-up")) {
                
                hero.powerUp();
            }
            else if(hero.isReady("bash")) {
                hero.bash(enemy);
            }
            else if(hero.canCast("chain-lighting", enemy)) {
                hero.cast("chain-lighting", enemy);
            }
            else {
                hero.shield();
                hero.attack(enemy);
            }
        }
    }
}

jumpTo({'x':120, 'y':39});
while(true) {
    var item = hero.findNearestItem();
    var enemy = hero.findNearestEnemy();
    summon();
    if (item) {
        hero.move(item.pos);
    }
    else if(enemy) {
        command(enemy);
    }
    else if(enemy) {
        attack(enemy);
    }
    
}

try deleating the top imo

1 Like

I found out the hard way that it doesn’t support default parameters :frowning:

function jumpTo(position, fast=true)

So the issue is the fast=true
It looks like it transpiles java script into coffeescript or something. Sad.

@AlyTomji plz don’t post on dead topics. I know your trying to help but this topic has been dead for a year

Is it dead? I consider this an active bug, how do you think I found this post?
Thanks to this post It was easy to find out what the issue is, and it’s a bug in the transpiles since both coffeescript and javascript support default parameters.

1 Like