Skip to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Problems regarding OSBot listeners

Featured Replies

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?

  • Author
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

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.

  • Author
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.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.