Jump to content

Error on start up [Help]


Recommended Posts

Posted

Hey guys, 

I have started writing my own script; I have most of it finished I think; I have created the .jar, I also can see it now on the script selector; However this is as far as I can get;

When i click run my GUI opens which is perfect however the client then lags like crazy and wont let me click or even close osbot down unless i task manage it and end the java task. 

I opened the logger first this time and it gave me this error

 

 
error in script executor! 
java.lang.NullPointerException
 
at main.getState(main.java50)
at main.onLoop(main.java 59)
at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(hk:274)
at java.lang.Thread.run(Unknown Source)

 

So i think my errors are here ? 

line 50

if (!inventory.contains(rawName) && !bankArea.contains(myPlayer()))

 

line 59

 

switch (getState()) {

 

Any help will be appreciated;

 

Also i can post more of the code if needed

Posted (edited)

rawName returns null, probably because you dont set it in your gui untill you click a button. You could just instantiate the variable by just doing String rawName = "". Albeit thats a bad practice IMO. So you should look into how to make your script wait untill the gui is closed.

http://osbot.org/forum/topic/91963-using-synchronized-to-your-advantage/

Also you can watch my tutorial series if you want to do tasks or better states, I upload new tutorials weekly.

http://osbot.org/forum/topic/114013-tutorial-seriesvideo-scripting-made-easy-with-in-depth-explanations/

Edited by Vilius
  • Like 1
Posted

rawName returns null, probably because you dont set it in your gui untill you click a button. You could just instantiate the variable by just doing String rawName = "". Albeit thats a bad practice IMO. So you should look into how to make your script wait untill the gui is closed.

http://osbot.org/forum/topic/91963-using-synchronized-to-your-advantage/

Also you can watch my tutorial series if you want to do tasks or better states, I upload new tutorials weekly.

http://osbot.org/forum/topic/114013-tutorial-seriesvideo-scripting-made-easy-with-in-depth-explanations/

 

 

Looking over it now thanks (: will post again if I get stuck

rawName returns null, probably because you dont set it in your gui untill you click a button. You could just instantiate the variable by just doing String rawName = "". Albeit thats a bad practice IMO. So you should look into how to make your script wait untill the gui is closed.

http://osbot.org/forum/topic/91963-using-synchronized-to-your-advantage/

Also you can watch my tutorial series if you want to do tasks or better states, I upload new tutorials weekly.

http://osbot.org/forum/topic/114013-tutorial-seriesvideo-scripting-made-easy-with-in-depth-explanations/

 

I still get a similar error, However I can now use the GUI fine, Once I click start; It gives me this error now

 

java.lang.NUllPointerException
at main.getstate(main.java:55)
at main.onLoop(main.java:64)
at org.osbot.rs07.eventScriptExecutor$InternalExecutor.run(hk:274)
at java.lang.Thread.run(Unknown Source)

 

Its the exact same lines; However my rawName should be declared once okay is pressed.

Posted (edited)

Looking over it now thanks (: will post again if I get stuck

I still get a similar error, However I can now use the GUI fine, Once I click start; It gives me this error now

java.lang.NUllPointerExceptionat main.getstate(main.java:55)at main.onLoop(main.java:64)at org.osbot.rs07.eventScriptExecutor$InternalExecutor.run(hk:274)at java.lang.Thread.run(Unknown Source)
Its the exact same lines; However my rawName should be declared once okay is pressed.
Lines seem to be changes unless you just formatted your code and the line is the same then either your area is null and or myPlayer returns null. If the latter then you would need to be logged in. Edited by Vilius
  • Like 1
Posted (edited)

Lines seem to be changes unless you just formatted your code and the line is the same then either your area is null and or myPlayer returns null. If the latter then you would need to be logged in.

 

Just formated code and added your lock thingy;

 

exact same lines of code /:

 

Still getting the same errors; I dunno what is wrong; 

Edited by whipz

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