Jump to content

NullPointerException help?


H0rn

Recommended Posts

So I have an error that I can't seem to solve, I'm probably overlooking it..

Error in script executor!
java.lang.NullPointerException
	at Main.getState(Main.java:118)
	at Main.onLoop(Main.java:143)
	at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(un:19)
	at java.lang.Thread.run(Unknown Source)

 

Lines 118 onward:

else if (!getBank().isOpen() && currentamulet.getId() == 1704 || inventory.contains(1704) && Banks.EDGEVILLE.contains(myPlayer()))
		{
    		myPlayer().getMethods().getEquipment().interact(EquipmentSlot.AMULET,"Remove");
    		sleep(random(600,1000));
			return State.NO_GLORY;
		}

 

Link to comment
Share on other sites

10 minutes ago, OllieW said:

So I have an error that I can't seem to solve, I'm probably overlooking it..


Error in script executor!
java.lang.NullPointerException
	at Main.getState(Main.java:118)
	at Main.onLoop(Main.java:143)
	at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(un:19)
	at java.lang.Thread.run(Unknown Source)

 

Lines 118 onward:


else if (!getBank().isOpen() && currentamulet.getId() == 1704 || inventory.contains(1704) && Banks.EDGEVILLE.contains(myPlayer()))
		{
    		myPlayer().getMethods().getEquipment().interact(EquipmentSlot.AMULET,"Remove");
    		sleep(random(600,1000));
			return State.NO_GLORY;
		}

 

Probably currentamulet is null.

Please group your logic together; you're shooting yourself in the foot by mixing different logical operators without grouping them.
It also looks like you've misunderstood the framework you're using, seeing as you're performing interactions in a method called getState; I would consider going over it again.

  • Like 1
Link to comment
Share on other sites

4 minutes ago, FrostBug said:

Probably currentamulet is null.

Please group your logic together; you're shooting yourself in the foot by mixing different logical operators without grouping them.
It also looks like you've misunderstood the framework you're using, seeing as you're performing interactions in a method called getState; I would consider going over it again.

 

Thanks for the tips and the feedback, you're right. This script is a complete mess to be honest.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...