Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Need help] Receiving error from getState

Featured Replies

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.

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 by harrypotter

  • 2 weeks later...

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.

 

 

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.