Jump to content

NullPointerException help?


Recommended Posts

Posted

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;
		}

 

Posted
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
Posted
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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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