Okay, So this is my second Script. First one is a simple Shrimp catcher at and it does the basic it fishes and drops.
Trying to make a combat script that loots and banks but I don't understand why my code doesn't even start up, Literally does nothing.
import java.util.Objects;
import org.osbot.rs07.api.GroundItems;
import org.osbot.rs07.api.Inventory;
import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.model.GroundItem;
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;
@ScriptManifest(author = "Jeef_", info = "Kills Cows and Banks", name = "CowKiller", version = 0, logo = "")
public class main extends Script{
Area Cowpen = new Area(3253, 3255, 3265, 3296).setPlane(0);
Area lumbank = new Area(3208, 3218, 3210, 3220).setPlane(2);
NPC cow = getNpcs().closest("Cow", "Cow calf");
public void onStart() {
}
public enum State {
WALK, BANK, KILL, WAIT;
}
public State getState() {
if (getInventory().isFull()) { // FULL COWHIDE
return State.BANK;
}
if (!Cowpen.contains(myPlayer())) { // IF I'M NOT AT THE COWPEN
return State.WALK;
}
if (cow != null && cow.exists() && cow.isAttackable() && !inventory.isFull()) { //KILLING COWS
return State.KILL;
}
if (myPlayer().isAnimating()) { // PROGRESS KILLING COWS
return State.WAIT;
}
return null;
}
@Override
public int onLoop() throws InterruptedException {
switch (getState()) {
case BANK:
RS2Object banker = getObjects().closest("Bank booth");
if (getWalking().webWalk(lumbank)) {
if (banker != null) {
if (banker.interact("Bank")) {
if (bank.isOpen()) {
if (bank.depositAll()) {
Timing.waitCondition(() -> inventory.isEmpty(), random (2000, 5000));
}
}
}
}
}
break;
case WALK:
if (getWalking().webWalk(Cowpen)) {
Timing.waitCondition(() -> Cowpen.contains(myPlayer()), random(2000, 5000));
}
break;
case KILL:
GroundItem hide = getGroundItems().closest("Cowhide");
if (cow.interact("Attack")) {
Timing.waitCondition(() -> myPlayer().isUnderAttack() || myPlayer().isAnimating(), random(2000, 3000));
if (!inventory.isFull()) {
hide.interact("Take");
sleep (random(500,900));
}
}
break;
case WAIT:
sleep (random(500, 900));
break;
}
return 0;
}
}