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.

NullPointer in api.map.area.contains when starting script in CLI mode with norandoms?

Featured Replies

I'm starting my script in CLI with 

-allow norandoms

and when onStart is called, my script first tries to get a good starting state by checking if we're currently in a bank with: 

Banks.GRAND_EXCHANGE.contains(script.myPlayer())

 

This is immediately causing a NullPointer Exception at "org.osbot.rs07.api.map.area.contains(jk:91)"

 

I originally thought perhaps OSBot hadn't fully initialized by the time onStart was called, so I added a 20 second sleep just to debug the problem.  However, this did nothing and the crash still occurred 20 seconds later.  

Is this a bug, or am I doing something wrong?

Guessing you aren't logged in when it occurs, hence 'myPlayer' being null?

Try checking loginstate

I allways use 

AREA.contains(myPlayer())

never saw script.myplayer

Try contains(myPlayer()) only

  • Author
1 hour ago, RuneMaker4657 said:

I allways use 


AREA.contains(myPlayer())

never saw script.myplayer

Try contains(myPlayer()) only

If you can simply call myPlayer, then you're in a class that inherits myPlayer (you probably extend bot or script).  I have custom classes that do not inherit from OSBot classes, so I have to actually pass script around.

 

1 hour ago, Alek said:

Why are you using script and not bot? 

Is there a reason I should use Bot over Script?  My main class extends script and passes itself to my "Activity" classes which actually contain the logic for doing things.  I got this style from guides like Apaec's Beginner Guide.  I saw that Explev used a different method of having his Activity classes inherit from MethodProvider, and then called exchangeContext(getBot) on each of them: https://github.com/Explv/Tutorial-Island/blob/master/src/script/TutorialIsland.java#L22; but exchangeContext is deprecated by the looks of it.

 

What would you recommend?

1 hour ago, FrostBug said:

Guessing you aren't logged in when it occurs, hence 'myPlayer' being null?

Try checking loginstate

That's probably the case.  I'm not sure why norandom is starting my script before my player is logged in; but maybe that boils down to me not understanding fully what norandom does.

 

I'll make sure to not initialize without checking loginstate first.  Thanks!

Edited by Colonel_Panic

1 hour ago, Colonel_Panic said:

That's probably the case.  I'm not sure why norandom is starting my script before my player is logged in; but maybe that boils down to me not understanding fully what norandom does.

I'll make sure to not initialize without checking loginstate first.  Thanks!

because norandoms disabled random solvers.

Autologin is a random solver

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.