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.

Unregistering a Random Solver (RunAwayFromCombat)

Featured Replies

Hey all, I have another issue lately. I can't seem to successfully unregister to RunAwayFromCombat hook.

 

Here is a piece of code I have with traces for now:

this.getBot().getRandomExecutor().unregisterHook(RandomEvent.RUN_AWAY_FROM_COMBAT);
		
if (this.getBot().getRandomExecutor().hasHook(RandomEvent.RUN_AWAY_FROM_COMBAT))
{
	log("RunAwayFromCombat random handler has hook");
}
else
{
	log("RunAwayFromCombat random handler does not have hook");
}

this.getBot().getRandomExecutor().registerRandoms();

if (this.getBot().getRandomExecutor().hasHook(RandomEvent.RUN_AWAY_FROM_COMBAT))
{
	log("RunAwayFromCombat random handler has hook");
}
else
{
	log("RunAwayFromCombat random handler does not have hook");
}

That is in my onStart() method. And I see that the "RunAwayFromCombat random handler does not have hook" twice in the log when starting -- indicating that it would not run, I imagine. Yet, when I am attacked by a swarm or other I still get the random RunAwayFromCombat overlay and OSBot handles it normally. Any ideas?

 

EDIT: Pretty sure I tried this without calling this.getBot().getRandomExecutor().registerRandoms() after unregistering the hook and it still didn't work.

Edited by bfir3

The RandomEvent enum does not refer to a solver:

 

d2733614dd228d15e3ae123706880a82.png

 

You can override the event in question like this:

this.getBot().getRandomExecutor().registerHook(new RandomBehaviourHook(RandomEvent.RUN_AWAY_FROM_COMBAT) { //STUFF };
  • Author

I don't need to provide additional functionality, I just want to disable it. Surely the "unregisterHook" method which takes a RandomEvent argument is intended for this?

I don't need to provide additional functionality, I just want to disable it. Surely the "unregisterHook" method which takes a RandomEvent argument is intended for this?

 

You can override it to remove functionality / disable it entirely.

 

Hook != Solver, RandomSolver != RandomBehaviorHook. Clearing hooks doesn't mean disabling the solver per se.

		script.getBot().getRandomExecutor().registerHook(new RandomBehaviourHook(RandomEvent.RUN_AWAY_FROM_COMBAT) {
			@Override
			public boolean shouldActivate() {
				return false;
			}
		});
Guest
This topic is now closed to further replies.

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.