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.

Script wont run no idea why

Featured Replies

I get this code when i try to run my code

 
 
[ERROR][06/09 07:20:59 PM]: Failed to start script [The Al-kharid Hermit]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.osbot.cOn.run(pj:215)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at alKharidSKiller.AKSkiller.<init>(AKSkiller.java:27)
... 8 more
 

 

You're getting a NullPointerException at line 27 of AKSkiller.java

 

If you showed the chunk of code surrounding that line, I could help further. My guess is you're trying to use an API method within the constructor of the class that extends Script.

 

Don't use the constructor. Instead, use the onStart method to write code you want to execute when the script starts. Calling things like myPlayer() in the constructor of your script class would result in a NPE, and seeing how you're getting one in the constructor, I'm guessing that's the reason.

Edited by fixthissite

  • Author

You're getting a NullPointerException at line 27 of AKSkiller.java

 

If you showed the chunk of code surrounding that line, I could help further. My guess is you're trying to use an API method within the constructor of the class that extends Script.

 

Don't use the constructor. Instead, use the onStart method to write code you want to execute when the script starts. Calling things like myPlayer() in the constructor of your script class would result in a NPE, and seeing how you're getting one in the constructor, I'm guessing that's the reason.

61218fb80a3f43d9042d05bc07a2ac1d.png

You're getting a NullPointerException at line 27 of AKSkiller.java

If you showed the chunk of code surrounding that line, I could help further. My guess is you're trying to use an API method within the constructor of the class that extends Script.

Don't use the constructor. Instead, use the onStart method to write code you want to execute when the script starts. Calling things like myPlayer() in the constructor of your script class would result in a NPE, and seeing how you're getting one in the constructor, I'm guessing that's the reason.

61218fb80a3f43d9042d05bc07a2ac1d.png
Yeah, initializing in the field is similar to initializing in the constructor.

Assign the values in onStart, not the field.

  • Author

Yeah, initializing in the field is similar to initializing in the constructor.

Assign the values in onStart, not the field.

Okay thanks ! I'll update once I do that!

I'm pretty certain that getWidgets().get(x, y); will actually return a NullPointerException if the widget is not open (citation needed)

Fix:

if (getWidgets().isVisible(x, y)) {
    RS2Widget widget = getWidgets().get(x, y);
}

 

I'm pretty certain that getWidgets().get(x, y); will actually return a NullPointerException if the widget is not open (citation needed)

Fix:

if (getWidgets().isVisible(x, y)) {
    RS2Widget widget = getWidgets().get(x, y);
}

 

It will not throw an NPE if the widget is not present. It will simply return null

Create an account or sign in to comment

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.