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.

Thread not dying after restart

Featured Replies

currently having an issue during world hopping where the log produces the following error:

"Script executor is taking too long to suspend; restarting now..."

however, the previous thread does not die and the script will seem to multi-thread with the previous thread and the new thread, this happens repeatedly until multiple threads are running consecutively all trying to do the same thing.

this is the snippet where the issue arises:

 

do {
    m.log("Hopping");
    m.getWorlds().hopToP2PWorld();
    m.sleep(15000);
} while (m.myPlayer().exists() && player == null);

any help would be appreciated and any further logs or code will be provided if needed.

 

 

 

Edited by ryank645

As said above, don't use while loops.

That being said your snippet is kinda weird, what is it you're trying to achieve?
You hop, you sleep 15 seconds & then you hop again if your player exists & player == null (who is player?)

  • Author

the problem persists even without the do while loop, although not as may threads are created. the snippet is trying to hop every 15 seconds until a certain player is found, player being a variable. the while myPlayer().isVisible is to stop execution when logged out for hopping too may times

15 minutes ago, ryank645 said:

the problem persists even without the do while loop, although not as may threads are created. the snippet is trying to hop every 15 seconds until a certain player is found, player being a variable. the while myPlayer().isVisible is to stop execution when logged out for hopping too may times

Why are you multi threading?

You should place your conditions in if-statements, something like this

if(player == null && myPlayer.isVisible){
  //Hop
}

 

Edited by Hybris

  • Author

i had the if-statement previously before the do loop, the issue was still there however i have reverted the changes.

i don't know multiple threads are being created that's my problem. the script produces the error "Script executor is taking too long to suspend; restarting now..."  but doesn't kill the old thread so they both run at the same time. is there any way to check the number of threads running and kill them? if not then how do i prevent this error.

Edited by ryank645

 

Make sure u use the script skeleton, if you put the if statement in the onLoop there shouldn't be a problem as far as I know.
You also need to make sure the script is sleeping while you're trying to log, otherwise it'll loop & you'll get multiple tries.

You can use conditional sleeps so it'll make sure you are hopped before waking up again.

https://osbot.org/forum/topic/127193-conditional-sleep-with-lambda-expressions/

 

If it still doesn't work, post the code you have & I'll take a look at it.

 

Edited by Hybris

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.