hello everyone
im trying to write my first script basicly a sandcrab training script.
now is my problem this:
NPC SC = npcs.closest("Sand Crab");
RS2Object BC = getObjects().closest("Bank chest");
Position MP = myPosition();
if (!CT.contains(MP) && getInventory().contains("Salmon")) {
log("Combat Area is empty walking to there now");
getWalking().webWalk(CT);
} else if (myPlayer().getHealthPercent() < 35) {
log("Health below 35% eating Salmon");
getInventory().interact("Eat", "Salmon");
} else if (CT.contains(SC) && SC != null && !myPlayer().isAnimating()) {
log("Attacking Sand Crab");
SC.interact("Attack");
sleep(50);
} else if (!myPlayer().isAnimating() && SC == null) {
log("resetting Agro");
getWalking().webWalk(RSA);
} else if (!getInventory().contains("Salmon")) {
log("No food found in inventory checking bank");
getWalking().webWalk(BT);
if (BT.contains(MP)) {
BC.interact("Use");
sleep(2000);
}
if (getBank().contains("Salmon")) {
getBank().withdrawAll("Salmon");
} else if (!getBank().contains("Salmon")) {
log("No food to be found please restock");
stop();
}
}
return random(3000, 60000);
}
it takes ages to get the log the attack even so long that it will log me out it
also wont move to RSA when he supposed to (if we dont have agro or !myPlayer().isAnimating())
this is all in onLoop()
am i missing something or ....
this is what comes from the logger
[INFO][Bot #1][09/14 09:37:23 PM]: Attacking Sand Crab
[INFO][Bot #1][09/14 09:41:16 PM]: Attacking Sand Crab
clearly its more then 1 minute
thanks in advance:D