Jump 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.

onLoop() not called with -norandoms on some occasions

Featured Replies

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?

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

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.

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.

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

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.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

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.