Jump to content

NullPointerException when using store.interact or store.buy


Recommended Posts

Posted (edited)

Hey, today I started making my first script and got a bug called NullPointerException when I try to use store.interact or store.buy from OSBot API.

Here's a part of my code:

if(store.isOpen()){
    status = "Buying";
    sleep(random(300,700));
    store.interact(8, "Buy 5");
    //...
}

What I would like to do in-game:

eRZtNqu.png

 

and here is the error:

[ERROR][Bot #1][09/10 10:31:22 PM]: Error in script executor!
java.lang.NullPointerException
	at org.osbot.rs07.api.Store.interact(xi:364)
	at main.onLoop(main.java:82)
	at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(ni:26)
	at java.lang.Thread.run(Unknown Source)

So how could I fix that?

Edited by Lordsthan
Posted

Hey, today I started making my first script and got a bug called NullPointerException when I try to use store.interact or store.buy from OSBot API.

Here's a part of my code:

if(store.isOpen()){
    status = "Buying";
    sleep(random(300,700));
    store.interact(8, "Buy 5");
    //...
}

What I would like to do in-game:

eRZtNqu.png

 

and here is the error:

[ERROR][Bot #1][09/10 10:31:22 PM]: Error in script executor!
java.lang.NullPointerException
	at org.osbot.rs07.api.Store.interact(xi:364)
	at main.onLoop(main.java:82)
	at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(ni:26)
	at java.lang.Thread.run(Unknown Source)

So how could I fix that?

On top of what Divinity said (and as I suggested in the PM), you should check out this thread, which contains custom interaction methods.

 

As you know, I'm not a scripter, so I can't confirm the efficiency of the methods (or if they even work), but it seems like a pretty good place to start.

 

Good luck :)

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