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

RandomBehaviourHook still not working

Featured Replies

Hey, I saw that Maxi updated this feature but I still can't get it to work!

 

It now throws these kind of errors at me:

[ERROR][05/30/13 11:58:03 PM]: Error on executing random worker!
java.lang.NullPointerException
	at org.osbot.script.MethodProvider.myPlayer(zg:99)
	at qDragon$1.shouldActivatePreLoop(qDragon.java:392)
	at org.osbot.script.rs2.randoms.RandomManager.scan(kn:107)
	at org.osbot.bA.run(mm:248)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:722)

For the code:

        randomManager.registerHook(new RandomBehaviourHook(RandomManager.EXP_REWARDS) {


                    @Override
                    public boolean shouldActivatePreLoop() { 
                        return myPlayer().isInArea(new Area(2826, 9821, 2847, 9833));
                    }

                    @Override
                    public int preLoop() throws InterruptedException {
                    	walkMiniMap(new Position(2822, 9826, 0));
            			sleep(400);
                        return gRandom(600, 300);
                    }


                }
        );

Is there anything I can do to fix this?

 

Thanks! :)

Looks like your getting a NPE on the "myPlayer()" method.

 

Try

  • client.getMyPlayer()
  • Author

 

Looks like your getting a NPE on the "myPlayer()" method.

 

Try

  • client.getMyPlayer()

 

 

I used that one in the first place, wouldn't work either. :/

Edited by Quint

  • Developer

A small note that is not documented, is that not the entire hook is inherently polymorphic, it's a fake instance of the RandomEventSolver in fact. I could write the wrapping methods, but instead you will have to use the field solver, however I just noticed it was never opened up for use. I'm very sorry for the inconvenience, such things should not slip my mind. I'll document it and open it up for usage on the next release.

  • Author

A small note that is not documented, is that not the entire hook is inherently polymorphic, it's a fake instance of the RandomEventSolver in fact. I could write the wrapping methods, but instead you will have to use the field solver, however I just noticed it was never opened up for use. I'm very sorry for the inconvenience, such things should not slip my mind. I'll document it and open it up for usage on the next release.

 

Thanks, I highly appreciate all the efforts you put into this, you are an amazing developer Maxi :)

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.