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.

Issue with getting myPosition()

Featured Replies

Hello all!

I'm writing a basic fishing script. When I set it up the first time it was working decently. Now I'm trying to map it over to a behavior tree (Task based script).

I have this issue where in a Task that checks if the player is at a spot, the myPosition() method keeps giving me a NullPointerException. It says the issue is at org.osbot.rs07.script.MethodProvider.myPlayer(xe:677) and (xe:679).

I've narrowed it down here. The MethodProvider is not null, the getInventory is not null, which means that other methods on the MethodProvider work. The only thing that's returning as null is the myPosition method.

Does anyone have any advice?

How do you know that the MethodProvider is not null?

log(myPosition());

I'd recommend trying the code above in your onStart method. If this works, your method provider may not be instantiated correctly. You need to use the main class as the method provider.

  • Author
2 hours ago, ExtraBotz said:

How do you know that the MethodProvider is not null?

log(myPosition());

I'd recommend trying the code above in your onStart method. If this works, your method provider may not be instantiated correctly. You need to use the main class as the method provider.

Hey thanks a lot for the suggestion. I determined the MethodProvider wasn't null by having it log something if it != null. The mistake I made was not using the main class as the provider and instead instantiating a new MethodProvider entirely. Your suggestion helped me debug the issue, and now I have my first properly implemented behavior tree! Thanks

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.