ForcaNL Posted December 6, 2015 Share Posted December 6, 2015 (edited) Hey guys, I'm trying to make my script manually login to my accounts but for some reason clicking/typing doesn't work when I'm logged off. This is what I got: Triggering my state: if(!client.isLoggedIn()) return State.LOGIN; Code in my case: case LOGIN: mouse.click(460, 290, false); getKeyboard().typeString("USERNAME HERE", true); sleep(random(500, 1500)); getKeyboard().typeString("PASSWORD HERE", true); sleep(random(4000,5000)); mouse.click(380, 330, false); sleep(random(4000,5000)); break; For some reason it seems to "work" when I'm online, but when I'm offline it just doesn't seem to trigger. Thanks alot in advance! Cheers, ForcaNL Edited December 6, 2015 by ForcaNL Quote Link to comment Share on other sites More sharing options...
FrostBug Posted December 6, 2015 Share Posted December 6, 2015 The AUTO_LOGIN Random Solver should automatically activate when logged out, granted that you're using a profile Quote Link to comment Share on other sites More sharing options...
Nitrousek Posted December 7, 2015 Share Posted December 7, 2015 if you want, I'm pretty sure you can unregister random behavior AUTOLOGIN, and then write your own handler for it, I just don't see a point really. Quote Link to comment Share on other sites More sharing options...
ForcaNL Posted December 7, 2015 Author Share Posted December 7, 2015 Hey FrostBug, Thanks a lot for the suggestion, but I really think I need to do this manually since I want to have the ability to switch accounts and put my own breaking system in place. Quote Link to comment Share on other sites More sharing options...
Flamezzz Posted December 7, 2015 Share Posted December 7, 2015 I'm not sure if it's still possible to unregister or hook autologin, I used to do that but it stopped working at some point. However, you can do something hacky like: try { Field f = bot.getClass().getSuperclass().getDeclaredField("account"); f.setAccessible(true); f.set(bot, new RSAccount()); } catch (NoSuchFieldException e) { log("bad mkay"); } catch (IllegalAccessException e) { log("bad mkay"); } Which makes sure the autologin doesn't trigger. You definitely don't want to push something like that to the SDN, but it's fine for private usage. At this point nothing happens because the scriptexecutor doesn't call onLoop() when the client is not logged in.To solve this you could create a Thread in onStart which runs in the background new Thread(() -> { while(running && !Thread.interrupted()) { if(!client.isLoggedIn()) { log("Logging in!"); try { mouse.click(460, 290, false); getKeyboard().typeString("USERNAME HERE", true); sleep(random(500, 1500)); getKeyboard().typeString("PASSWORD HERE", true); sleep(random(4000,5000)); mouse.click(380, 330, false); sleep(random(4000,5000)); } catch (InterruptedException e) { } } try { Thread.sleep(1000); } catch (InterruptedException e) { } } }).start(); Seems to work for me 1 Quote Link to comment Share on other sites More sharing options...