In-game Functions

combatManager.slayerTask.killsLeft = 99999

var count = 30;
var tier = -1;
var costCoins = 0;
var monsID = 10;
while(count > 1 && combatManager.slayerTask.monster.id != monsID) {
    if (MONSTERS[monsID] && MONSTERS[monsID].canSlayer) {
        for (i in CONSTANTS.slayerTier) {
            if (combatManager.slayerTask.getMonsterSelection(CONSTANTS.slayerTier[i]).some(e => e.id === monsID)) {
                tier = CONSTANTS.slayerTier[i]
            }
        }
        if (tier == -1) {
            console.log("Unable to find correct slayer tier.");
            break;
        }
    } else {
        console.log("Not a slayer monster.");
        break;
    }

    combatManager.slayerTask.selectTask(tier,costCoins,true,true);
    console.log(count);
    count = count - 1;

    var now = new Date().getTime();    
    if (combatManager.slayerTask.monster.id == monsID) {
        console.log("Found monster!");
        combatManager.slayerTask.jumpButton.click();
    } else {
        while(new Date().getTime() < now + 1500){ /* Do nothing */ }
    }
}