scape Posted September 27, 2017 Share Posted September 27, 2017 This bug only happens when I have my own login handler implemented. I start the bot with -allow norandoms. The script functions flawlessly for some time, but after a while they all hang on logout screen. This is my onLoop method: @Override public int onLoop() { if (this.lastLoopPrint <= 0 || System.currentTimeMillis() - this.lastLoopPrint >= 10000) { this.lastLoopPrint = System.currentTimeMillis(); log("Printing in loop"); } handleState(getState()); return random(300, 800); } "Printing in loop" isn't called on the bots that have hung on logout. This means that onLoop is not being called. Why would this be happening? Is this a bot bug? Quote Link to comment Share on other sites More sharing options...
The Undefeated Posted September 27, 2017 Share Posted September 27, 2017 You might wanna show your other code as well. It's probably stuck in a loop or sleep. Quote Link to comment Share on other sites More sharing options...
scape Posted September 27, 2017 Author Share Posted September 27, 2017 8 minutes ago, The Undefeated said: You might wanna show your other code as well. It's probably stuck in a loop or sleep. doesn't on loop take priority? I don't have any infinite sleeps... it should be printing no matter what? Quote Link to comment Share on other sites More sharing options...
HeyImJamie Posted September 27, 2017 Share Posted September 27, 2017 32 minutes ago, scape said: doesn't on loop take priority? I don't have any infinite sleeps... it should be printing no matter what? Not if there's an issue with a getState, it'll get stuck there. Quote Link to comment Share on other sites More sharing options...
d0zza Posted September 27, 2017 Share Posted September 27, 2017 Some functions like walking wait till they're finished being executed before letting the rest of your code run again, what's probably happening is that you get logged out during an operation like this and so your login handler never gets to start running again. Add break conditions to your code for when the client isn't logged in. Quote Link to comment Share on other sites More sharing options...
scape Posted September 27, 2017 Author Share Posted September 27, 2017 21 minutes ago, HeyImJamie said: Not if there's an issue with a getState, it'll get stuck there. 10 minutes ago, d0zza said: Some functions like walking wait till they're finished being executed before letting the rest of your code run again, what's probably happening is that you get logged out during an operation like this and so your login handler never gets to start running again. Add break conditions to your code for when the client isn't logged in. I have a check in getState() that returns state LOGIN if not logged in at the very topic before anything is executed. How would I break out of an event such as web walking that would be taking too long? Quote Link to comment Share on other sites More sharing options...
d0zza Posted September 27, 2017 Share Posted September 27, 2017 1 minute ago, scape said: I have a check in getState() that returns state LOGIN if not logged in at the very topic before anything is executed. How would I break out of an event such as web walking that would be taking too long? Your check in getState() does not matter if it is not being run, like I said above. For web walking read through this guide by Team Cape Otherwise add !getClient().isLoggedIn() as a break condition to your conditional sleeps and wherever else you feel necessary. Quote Link to comment Share on other sites More sharing options...