Jump to content

Disable Auto-Login?


Aerospark

Recommended Posts

Hey, just wondering if there’s a way to disable auto-login, whether it be in the settings or a way to specify it in the script. I couldn't find anything in the API docs, but I could have easily missed something.

I'd mainly like to know because its important that my script uses it's own login handling code.

 

        this.bot.getRandomExecutor().unregisterHook(RandomEvent.AUTO_LOGIN);
 
or 
 
        this.bot.getRandomExecutor().registerHook(new RandomBehaviourHook(RandomEvent.AUTO_LOGIN)
        {
            public String getName() {
                return super.getName();
            }
 
            public boolean shouldActivate()
            {
                return false;
            }
        });
 
you will also probably need to disable world hopper system if you are using it.
 
To make the actual login handler, you need to make a new thread and run it on that, otherwise you can't run anything on the script until logged into game.
  • Like 1
Link to comment
Share on other sites

Bit of a follow up to this, it is possible to access the random solvers before the login screen, onStart runs pretty much right away, but the login solver seems to be in RandomExecutor.otherSolvers instead of the standard solver map. I'm not sure if I can access this without using reflection, will edit this post with more info shortly.


EDIT: Here's the code I eventually ended up using, it's a bit overboard, but it does work

 

public void clearALLRandomHooksAndSolvers() throws IllegalAccessException, SecurityException, NoSuchFieldException{
        bot.getRandomExecutor().clearHooks(); // does nothing
        bot.getRandomExecutor().unregisterHook(RandomEvent.AUTO_LOGIN); // also does nothing
        RandomExecutor exec = bot.getRandomExecutor();
        Field other = exec.getClass().getDeclaredField("otherSolvers");
        other.setAccessible(true);
        ((Set<RandomSolver>)other.get(exec)).clear();
        Field solver = exec.getClass().getDeclaredField("solvers");
        solver.setAccessible(true);
        ((Map<RandomEvent, RandomSolver>)solver.get(exec)).clear();
        Field hooks = exec.getClass().getDeclaredField("hooks");
        hooks.setAccessible(true);
        ((Map<RandomEvent, RandomBehaviourHook>)hooks.get(exec)).clear();
}
Edited by Aerospark
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...