Jump to content

Problems regarding OSBot listeners


Butters

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...