if (!getMagic().isSpellSelected()) {
if (getMagic().castSpell(NormalSpells.SUPERHEAT_ITEM)) {
new ConditionalSleep(5000) {
@Override
public boolean condition() throws InterruptedException {
return getMagic().isSpellSelected();
}
}.sleep();
}
} else {
long invAmount = getInventory().getAmount("Iron ore");
if (getInventory().interact("Cast", "Iron ore")) {
new ConditionalSleep(5000) {
@Override
public boolean condition() throws InterruptedException {
return invAmount != getInventory().getAmount("Iron ore");
}
}.sleep();
}
}
I have the above in a script and the interaction occasionally fails. The script will cast a few hundred casts and eventually fail and I am not too sure why.
The script will go on its way and then after a few hundred casts just stops. The spell is selected and the bot is stuck in the inventory hovering the iron ore to interact with it.
Is this an API bug or have I possibly done something that isn't reliable?