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.

Sleep until animation finished

Featured Replies

Need some help figuring out how to sleep until the player returns to stand animation.

Firemaking can take random lengths of time or failing, so I need to figure out how to sleep till animation is done.

						new ConditionalSleep(random(2_500)) {
							@[member=Override]
							public boolean condition() throws InterruptedException {
								return !myPlayer().isAnimating();
							}
						}.sleep();

Don't you need to remove the ! on !myPlayer().isAnimating(); in this case, because you want the sleep to trigger when it is animating. 

 

(don't quote me as i don't know wtf im talking about, but maybe try it)

 

Don't you need to remove the ! on !myPlayer().isAnimating(); in this case, because you want the sleep to trigger when it is animating. 

 

(don't quote me as i don't know wtf im talking about, but maybe try it)

No, he wants to stop the sleep when the player is done animating.

The issue @OP is that the player doesn't start animating until ~ 1 second after the log is clicked, then he starts animating. You might need to regularsleep for like ~ 1 second before using that conditional sleep, ironically enough.

  • Author

I tried something like that before and it just comes down to if the player will take longer on a log. Even with my 40 firemaking I sometimes slow down on random logs. Which is why I need to figure out the proper function for sleeping till no animation to prevent this issue.

Edited by Booleans YAY

 basic

	public static long timeFromMark(long markTime) {
		return System.currentTimeMillis() - markTime;
	}

also basic but not obvious to most

	public static boolean doSomething(Script script) throws InterruptedException {
		script.getSomething().doSomething() // make your fire or whatever
		long t = System.currentTimeMillis();
		while (placeConditionsHere) // while animating for example
	                if (timeFromMark(t) > 3000) // change 3000 to whatever you want
				break;
                                // you can place a sleep here if you want to use less cpu but it makes no difference imo
		return false;
        }

i've never used the osbot api for conditional sleeps but my snippet does essentially the same thing and is easily expanded on. good luck!

 

edit: you can modify my snippet to account for the delay before you start animating as well. i'll leave that for you to figure out though :p

Edited by Shiny

Yeah, sleeping while is animating has been doing weird on some things for me too. You could also check something like, as soon as I gain firemaking xp, continue to the next log.

 

edit: in other words, sleep if you havent gained xp since last log burned

Edited by Borre

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.