Hey guys, I created a simple fishing bot that clicks on the Net fishing spot for shrimp and anchovies. It's really simple, but I'd like to try and make it more complex. Right now, when I run it, the bot gets to the antiban section under "while (myPlayer().isAnimating())" section under the FISH enum state. Every time it hits the antiban, the chacter is animating, but sometimes the character stops animating mid-antiban. The bot runs through the entire antiban loop, and then clicks on the fishing spot. How can I keep it constantly updating, and override the antiban? I want it to immediately click the fishing spot if it stops fishing, not wait for the antiban to end. PLEASE HELP!
Thanks.
Code below:
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.api.ui.Tab;
import org.osbot.rs07.script.MethodProvider;
import java.awt.*;
@ScriptManifest(author = "Computor", info = "My first script", name = "Simple Power-Shrimper", version = 1.0, logo = "")
public class main extends Script {
private static final int[] FISHING_ID = {1528};
@Override
public void onStart() {
log("Simple power-fisher for anchovies and shrimps. Run anywhere.");
}
private enum State {
FISH, DROP, WAIT
};
private State getState() {
if (inventory.isFull())
return State.DROP;
return State.FISH;
}
@Override
public int onLoop() throws InterruptedException {
switch (getState()) {
case FISH:
if (!myPlayer().isAnimating()) {
NPC Fishing_spot = npcs.closest(FISHING_ID);
if (!inventory.isFull()){
Fishing_spot.interact("Net");
sleep(random(800,1200));
}
while (myPlayer().isAnimating()){
sleep(MethodProvider.gRandom(6000, 13000));
getTabs().open(Tab.SKILLS);
sleep(MethodProvider.gRandom(300, 1200));
getSkills().hoverSkill(Skill.FISHING);
sleep(MethodProvider.gRandom(3000, 4000));
getTabs().open(Tab.INVENTORY);
sleep(MethodProvider.gRandom(7000, 12000));
getMouse().moveRandomly();
}
}
break;
case DROP:
inventory.dropAllExcept(303);
break;
case WAIT:
sleep(random(500, 700));
break;
}
return random(200, 300);
}
@Override
public void onExit() {
log("End of fishing script.");
}
@Override
public void onPaint(Graphics2D g) {
}
}