Jump to content

Unregistering a Random Solver (RunAwayFromCombat)


bfir3

Recommended Posts

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
Link to comment
Share on other sites

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;
			}
		});
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...