Aerospark Posted October 25, 2014 Share Posted October 25, 2014 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. Link to comment Share on other sites More sharing options...
Th3 Posted October 25, 2014 Share Posted October 25, 2014 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. 1 Link to comment Share on other sites More sharing options...
Aerospark Posted October 25, 2014 Author Share Posted October 25, 2014 (edited) Thanks for the reply Exactly what I was looking for.So the script doesn't run until it's logged in, do you happen to know if it stops the active script on log out or? Edited October 25, 2014 by Aerospark Link to comment Share on other sites More sharing options...
Aerospark Posted October 26, 2014 Author Share Posted October 26, 2014 (edited) 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 October 26, 2014 by Aerospark Link to comment Share on other sites More sharing options...