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.

How to suppreess LoginEvent and inventory listener question

Featured Replies

Hi there guys. So today I stumbled upon these two things when writing a script.

 

First I have problem with keeping track of how many things I have gathered. I have tried many ways of doing it, even went here for help and found this post http://osbot.org/forum/topic/75766-inventorymonitor-snippet/?hl=thread which worked pretty well, but every time I hopped world, the last ammount added, was added again. So say I had 10 items in inventory, I gathered another 5 (15 now) and when I hopped world the counter went to 20. So how should a basic thread based inventory listener look like - which will work with world hopping?

 

Another thing that I found problematic was the world hopping limit - after some ammount of worlds hopped in fast succession it will log you out. So I would like to make it so my script will sleep for like 5 mins when this happens and after that comes back. How could I suppress LoginEvent when I get logged out and then use it again after some time?

 

If someone can help me with those two things, please post ahead, I would appreciate it :)

For the latter I think this could help you:

 

client.isLoggedIn()

and

bot.getRandomExecutor().unregisterHook(RandomEvent.AUTO_LOGIN)

Why is it adding another five when you hop worlds?

Why does your solution involve adding an inventory listener; are you aware of the consequences (good and bad) of using one?

 

 

 

  • Author

Why is it adding another five when you hop worlds?

Why does your solution involve adding an inventory listener; are you aware of the consequences (good and bad) of using one?

 

I think I have used the wrong term. I need InventoryMonitor - which will count how many items I've gathered. The one I linked in the post works fine, but I had to add a check for when I'm banking, because it worked both ways: adding and substracting aswell. But that was easy. And I don't know why it increments the counter variable when hopping worlds.

1 override the login random

 

2 also for the inventory listener. Use the responsive code to determine the state of the game.

Im sure the listener class all it needs a simple if statement.

  • Author

1 override the login random

 

2 also for the inventory listener. Use the responsive code to determine the state of the game.

Im sure the listener class all it needs a simple if statement.

 

Hmm, I guess it should work when I rule out the increments done while hopping worlds.

  • Author

 

For the latter I think this could help you:

 

client.isLoggedIn()

and

bot.getRandomExecutor().unregisterHook(RandomEvent.AUTO_LOGIN)

 

@Flamezzz How would I then register auto_login back again? registerHook() and registerRandoms() is not working with RandomEvent.AUTO_LOGIN...

@Flamezzz How would I then register auto_login back again? registerHook() and registerRandoms() is not working with RandomEvent.AUTO_LOGIN...

Mhm... I've tried, without success, both overriding the AutoLogin solver and unregistering/registering it unsure.png

Edited by Flamezzz

@Flamezzz How would I then register auto_login back again? registerHook() and registerRandoms() is not working with RandomEvent.AUTO_LOGIN...

 

let me help you out.

 

create your own random solver http://osbot.org/api/org/osbot/rs07/script/RandomSolver.html with out script manifest

then you would get the random executor from the bot class.

use the method Bot#registerRandoms(arg) (add your random solver as the arg)

finally remove the login random by unregister it

 

the reason why you still have to remove it because registerRandoms()

the method above

Reloads all random solvers and registers third party randoms designed for particular scripts.

WITHDRAW_NOTE: The third part random solvers specified here should not have a @link ScriptManifest attribute!

  • Author

 

let me help you out.

 

create your own random solver http://osbot.org/api/org/osbot/rs07/script/RandomSolver.html with out script manifest

then you would get the random executor from the bot class.

use the method Bot#registerRandoms(arg) (add your random solver as the arg)

finally remove the login random by unregister it

 

the reason why you still have to remove it because registerRandoms()

 

 

Thanks man, I've already done this in my onStart() and it seems to be working...

bot.getRandomExecutor().unregisterHook(RandomEvent.AUTO_LOGIN);
bot.getRandomExecutor().registerHook(new RandomBehaviourHook(RandomEvent.AUTO_LOGIN) {
	@Override
	public void onStart() throws InterruptedException{
		mouse.moveOutsideScreen();
		sleep(random(180000,240000));
	}
});

Edited by blabla123

 

Thanks man, I've already done this in my onStart() and it seems to be working...

bot.getRandomExecutor().unregisterHook(RandomEvent.AUTO_LOGIN);
bot.getRandomExecutor().registerHook(new RandomBehaviourHook(RandomEvent.AUTO_LOGIN) {
	@Override
	public void onStart() throws InterruptedException{
		mouse.moveOutsideScreen();
		sleep(random(180000,240000));
	}
});

nice i never really played with these hooks but nice to hear back that you got it to work.

Create an account or sign in to comment

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.