I began creating a new woodcutting script, but I keep on receiving this error regularly. It doesn't crash the script.
[ERROR][Bot #1][05/01 09:23:06 PM]: Error in script executor!
java.lang.NullPointerException
at chopp.onLoop(chopp.java:57)
at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(nl:235)
at java.lang.Thread.run(Unknown Source)
This is the code from the getState. Line 57 is the 3rd line down here (switch (getState()) ).
public final int onLoop() throws InterruptedException {
sleep(50);
switch (getState()) {
case CUT: {
if (!treeArea.contains(myPosition())) {
getWalking().webWalk(treeArea);
sleep(random(50, 100));
}
Entity tree = objects.closest(treeArea, "Tree");
if (tree != null && !myPlayer().isMoving()
&& !myPlayer().isAnimating()) {
tree.interact("Chop down");
sleep(1250);
}
break;
}
case BANK: {
BANK();
break;
}
case DROP: {
inventory.dropAllExcept(axes);
break;
}
case WAIT: {
if (myPlayer().isAnimating()) {
sleep(random(500,700));
}
break;
}
}
return random(200, 300);
}
Thanks for the help.