Hey can anyone help me here I made a simple script and when I start to the script it doesnt start.
package core;
import org.osbot.rs07.api.Objects;
import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;
import static core.PestControl.State.*;
@ScriptManifest(version = 0, info = "Pest Control :D", logo = "", author = "Nimmogel", name = "Pest Control")
public class PestControl extends Script {
final State state = getState();
Area onBoatArea = new Area(2637, 2647, 2641, 2641);
Area pcArea = new Area(2623, 2622, 2689, 2561);
Area killArea = new Area(2627, 2596, 2640, 2587);
Area outsideBoat = new Area(2644, 2646, 2644, 2642);
String[] pestControlMonsters = {"Brawler","Defiler","Ravager","Shifter","Spinner","Torcher"};
public void onStart() throws InterruptedException {
log("Pest Control has started :D");
}
public enum State {
ATTACK,
ONBOAT,
BOAT,
WALKTOSPOT
}
private State getState() {
if (!pcArea.contains(myPlayer()) && !onBoatArea.contains(myPlayer())) {
return BOAT;
}
if (onBoatArea.contains(myPlayer())) {
return ONBOAT;
}
if (pcArea.contains(myPlayer()) && !killArea.contains(myPlayer())) {
return WALKTOSPOT;
}
if (killArea.contains(myPlayer())) {
return ATTACK;
}
return null;
}
@Override
public int onLoop() throws InterruptedException {
switch (getState()) {
case ATTACK:
NPC monster = npcs.closest(pestControlMonsters);
log("atack monsters");
if (monster != null) {
if (monster.isVisible()) {
if (monster.interact("Attack")) {
new ConditionalSleep(5000) {
@Override
public boolean condition() throws InterruptedException {
return !myPlayer().isAnimating();
}
}.sleep();
}
}
}
break;
case ONBOAT:
log("onBoat");
new ConditionalSleep(5000) {
@Override
public boolean condition() throws InterruptedException {
return pcArea.contains(myPlayer());
}
}.sleep();
break;
case BOAT:
RS2Object plank = new Objects().closest("Gangplank");
log("boat case");
if (plank != null) {
if (plank.isVisible()) {
if (plank.interact("Cross")) {
new ConditionalSleep(5000) {
@Override
public boolean condition() throws InterruptedException {
return onBoatArea.contains(myPlayer());
}
}.sleep();
}
}
} else {
getWalking().walk(outsideBoat);
sleep(random(650,900));
}
break;
case WALKTOSPOT:
log("walking to kill area");
getWalking().webWalk(killArea);
sleep(random(650,900));
break;
}
return 120;
}
@Override
public void onExit() {
log("Thanks for running my Pest Control");
}
}