Butters Posted December 17, 2017 Share Posted December 17, 2017 Has anyone else had the probem when OSBot listeners sort of stop working? Having issues with MessageListener (onMessage) and LoginResponseCodeListener. Gonna be a little vague here and can't post source of scripts, cause they're preety big. Situation: I've put a log message at the start of onMessage just to monitor this behaviour public void onMessage(Message message) { log("Messages are ok!"); /* Other code */ } After the bot runs for about 30~ minutes, I stop getting the output "Messages are ok!" to terminal. At the very same time LoginResponseCodeListener stops working properly as well, eg (simplified code, using a variation of Explvs login handler): public final class LoginEvent extends Event implements LoginResponseCodeListener { @ Override public final int execute() throws InterruptedException { if (getClient().isLoggedIn() && getLobbyButton() == null) { setFinished(); } else { login(); } return random(100, 150); } @ Override public final void onResponseCode(final int responseCode) throws InterruptedException { if(ResponseCode.isDisabledError(responseCode)) { log("Login failed, account is disabled"); banned = "Y"; setFailed(); return; } } Usage: LoginEvent loginEvent = new LoginEvent(); execute(loginEvent); I end up never getting the response code and etc if the account is banned. There are sleeps that wait until the event is finished or failed and it seems that the event never finishes. That is lloginEvent.hasFinished() || loginEvent.hasFailed() doesn't return true, though the event already did what it supposed to do. Looks like onResponseCode() doesn't get called at all. The reason I'm asking is cause my other scripts that use basically the same code (and yes I checked an rechecked) don't run into this listener issue. Nothing special happens when the listeners stop working. I monitored carefully and it's just "poof" - no more message from onMessage(); I'm also using WalkingEvent and WebWalkEvent explicitly throughout my code. (other scripts I run have less of these): WalkingEvent walkEvent = new WalkingEvent(); walkEvent.setPath(s.toBankPositions); walkEvent.setBreakCondition(Utils.getPathBreakCondition(s)); s.execute(walkEvent); It works fine. Might it be that some events are blocking others? Basically I'm asking this: 1) More knowledge on how events work on OSBot. Might it be that some are blocking others, can't finish and etc and how to combat this if this is the case. 2) Anyone else had similar issues? Quote Link to comment Share on other sites More sharing options...
The Undefeated Posted December 18, 2017 Share Posted December 18, 2017 Are you running multiple threads in your script? Had some weird things appear when doing so myself. Quote Link to comment Share on other sites More sharing options...
Butters Posted December 18, 2017 Author Share Posted December 18, 2017 Just now, The Undefeated said: Are you running multiple threads in your script? Had some weird things appear when doing so myself. Running only one additional thread regarding stat gathering and communication to a outer program. This really shouldn't be the case Quote Link to comment Share on other sites More sharing options...
d0zza Posted December 18, 2017 Share Posted December 18, 2017 WalkingEvents and WebWalkEvents block the rest of your script from running as long as they are being executed and as far as I know onMessage is run after (or before, don't remember) your onLoop is run so if you do have a walkingEvent that takes a while it could be stopping your onMessage from running. However I can't say I've ever experienced these issues as I've never needed an onMessage to run while walking. Quote Link to comment Share on other sites More sharing options...
Butters Posted December 20, 2017 Author Share Posted December 20, 2017 On 12/18/2017 at 9:18 PM, d0zza said: WalkingEvents and WebWalkEvents block the rest of your script from running as long as they are being executed and as far as I know onMessage is run after (or before, don't remember) your onLoop is run so if you do have a walkingEvent that takes a while it could be stopping your onMessage from running. However I can't say I've ever experienced these issues as I've never needed an onMessage to run while walking. Yep I noticed this as well. The problem is that the script itself works fine (does other stuff apart walking), though the listeners are basically dead. Quote Link to comment Share on other sites More sharing options...