June 19, 20196 yr 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 June 19, 20196 yr by ryank645
June 19, 20196 yr You're already on a loop, I suggest not using a Do/While Edited June 19, 20196 yr by Ragboys is back
June 19, 20196 yr 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?)
June 19, 20196 yr 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
June 19, 20196 yr 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 June 19, 20196 yr by Hybris
June 19, 20196 yr 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 June 19, 20196 yr by ryank645
June 19, 20196 yr 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 June 19, 20196 yr by Hybris
Create an account or sign in to comment