This is the first script I have created, there seems to be problem when running the script. It will only drop items but not chop down the willows near it.
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.api.model.Entity;
import java.awt.*;
@ScriptManifest(author = "SS", info = "First script", name = "test1", version = 0, logo = "")
public class Main1 extends Script {
public static final int[] WOODCUTTING_ID = { 11753, 11752, 11751 };
@Override
public void onStart() {
log("Let's get started!");
}
private enum State {
DROP, CHOP, WAIT
};
private State getState() {
if (!inventory.isFull())
return State.DROP;
return State.CHOP;
}
@Override
public int onLoop() throws InterruptedException {
switch (getState()) {
case CHOP:
if (!myPlayer().isAnimating()) {
Entity Willow = objects.closest(WOODCUTTING_ID);
if (Willow != null) {
Willow.interact("Chop-down");
sleep(random(25, 30));
}
}
break;
case DROP:
inventory.dropAll();
break;
case WAIT:
sleep(random(500, 700));
break;
}
return random(200, 300);
}
@Override
public void onExit() {
log("T!");
}
@Override
public void onPaint(Graphics2D g) {
}
}
First attempt
Also is there any other tutorials out there that can improve my skills?