May 1, 20178 yr 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.
May 1, 20178 yr 7 minutes ago, Jaffa said: 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. NVM, see @Charlotte's answer Edited May 1, 20178 yr by harrypotter
May 13, 20178 yr Don't know if you still need help, but could you post your getState method? Other than that, removing the { and } right after case cut did the trick for me http://prntscr.com/f79d0a Have to write the switch statement correctly.. took me a while to figure this out too lmao.