Heya I just wanted to ask how I could make it that my Player does stop if he interact with the Rock (mining) I could put sleeping on like 10 secs but I want to that he not waits 10 sec even he mined the rock after 2 secs.
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.awt.*;
@ScriptManifest(author = "Someone", info = "Testing", name = "Mining Test", logo = "", version = 0)
public class main extends Script {
@@Override
public void onStart() {
log("Shitty test");
}
private enum State {
MINE, DROP, WAIT
};
private State getState() throws InterruptedException {
Entity stall = objects.closest("Rocks");
inventory.dropAllExcept(1265);
sleep(random(1000));
if (stall != null)
return State.MINE;
return State.WAIT;
}
@@Override
public int onLoop() throws InterruptedException {
switch (getState()) {
case MINE:
Entity stall = objects.closest("Rocks");
if (stall != null) {
stall.interact("Mine");
}
break;
case DROP:
inventory.dropAll();
break;
case WAIT:
sleep(random(500, 700));
break;
}
return random(200, 300);
}
@@Override
public void onExit() {
log("Test more");
}
@@Override
public void onPaint(Graphics2D g) {
}
}
Thanks for any help.
~Life