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.

Alternative for isAnimating

Featured Replies

Hi,

As i described in this topic: 

The isAnimating method will return false even if your player is not animating for 300 ms (While it should return true). I tried creating it myself but it's not working.

    private long lastTrueTime;        
		private boolean animating() {

            long now= System.currentTimeMillis();
            if(myPlayer().isAnimating()) {
                lastTrueTime = now;
                return true;
            }
            if(lastTrueTime + 3000 < now) {
                return false;
            }

        return true;
    }

This does the same as the isAnimating method, as soon as the player stops animating for 1ms it returns false.

What is wrong with it?

 

The isAnimating() method does exactly what it is supposed to do. Character animation sequences are not continuous, a character has many animations and in order to play another animation it will always have a transition period between 2 animations (eg: Unity State Machine transitions, animation blending curves).

Let Animation1 and Animation2 be 2 animation clips played by a character and none the neutral state

Animation1 ----> Animation2 ----> Animation2 ----> none, none ----> Animation2

Arrows represent transitions, either abrupt or through blending, in runescape's case there is no blending. There is a transition even in a sequence of the same animation because the skeleton of your character has to change but there will not be a transition between neutral states because the bones do not change position and the time of the animation converges to 0.

 

In conclusion the character animation should not be used for anything that describes continuity and you should only rely on it as a trigger (and no, isAnimating() shouldn't return true).

  • Author
6 minutes ago, Token said:

The isAnimating() method does exactly what it is supposed to do. Character animation sequences are not continuous, a character has many animations and in order to play another animation it will always have a transition period between 2 animations (eg: Unity State Machine transitions, animation blending curves).

Let Animation1 and Animation2 be 2 animation clips played by a character and none the neutral state

Animation1 ----> Animation2 ----> Animation2 ----> none, none ----> Animation2

Arrows represent transitions, either abrupt or through blending, in runescape's case there is no blending. There is a transition even in a sequence of the same animation because the skeleton of your character has to change but there will not be a transition between neutral states because the bones do not change position and the time of the animation converges to 0.

 

In conclusion the character animation should not be used for anything that describes continuity and you should only rely on it as a trigger (and no, isAnimating() shouldn't return true).

Okay, but why does the description say so?

And if it shouldn't be used like this, there is no other possible way to see if a player is animating.

 

 

Edited by The Undefeated

Just now, The Undefeated said:

Okay, but why does the description say so?

And if it shouldn't be used like this, there is no other possible way to see if a player is animating.

 

 

The description is most likely wrong, last time I checked 70% of the API wasn't even documented but the return value looks correct to me. Yes there is, by hardcoding a method to verify this but as I mentioned in the last part "the character animation should not be used for anything that describes continuity and you should only rely on it as a trigger", I doubt you need to use the animation the way you are trying to do it. If you need any advice, let me know what you are trying to use it for.

  • Author
30 minutes ago, Juggles said:

 

private long lastAnimation = 0;

        private boolean isFletching() {


            if (myPlayer().isAnimating()) {
                lastAnimation = System.currentTimeMillis();
                return true;

            } else if (System.currentTimeMillis() > (lastAnimation + 3000)){
                return false;

            } else if (System.currentTimeMillis() < (lastAnimation + 3000)) {
                return true;
            }
            else {
                return false;
            }
        }

I am so fucking confused. If the player is not animating it will always return that it's longer than 3 seconds ago which is just not true.

The method runs every half a second and still saying it's longer than 3 seconds ago.

 

ConditionalSleep returns a boolean based on whether it's return statement was met or it timed out. You can use this to detect where you're still animating or you've ended.

  • Author
22 minutes ago, Night said:

ConditionalSleep returns a boolean based on whether it's return statement was met or it timed out. You can use this to detect where you're still animating or you've ended.

I could but when I use ConditionalSleep I can't run my AntiBan method so that's not practical.

I logged the state of my code and something is completely wrong.

[INFO][Bot #1][02/25 08:40:10 PM]: Animating 				1488051610387
[INFO][Bot #1][02/25 08:40:10 PM]: Animating 				1488051610654
[INFO][Bot #1][02/25 08:40:10 PM]: Less than 3 seconds ago animating 	1488051610920
[INFO][Bot #1][02/25 08:40:11 PM]: Less than 3 seconds ago animating	1488051611216
[INFO][Bot #1][02/25 08:40:11 PM]: Longer than 3 seconds ago animating	1488051611773
[INFO][Bot #1][02/25 08:40:11 PM]: STRING
[INFO][Bot #1][02/25 08:40:12 PM]: Animating 				1488051612064

As soon as my player stops animating it will check if it stopped animating 3 seconds ago. I posted the ms time with it and as you can see between "animating" and "longer than 3 seconds ago " is a difference of 1119 ms which is not 3000ms. I have no idea why it still outputs that it's longer than 3 seconds ago.

 

    private long lastAnimation;

        private boolean isFletching() throws InterruptedException {

            sleep(random(200,300));
            if (myPlayer().isAnimating()) {
                lastAnimation = System.currentTimeMillis();
                log("Animating " + System.currentTimeMillis());
                return true;
            } else if (System.currentTimeMillis() < (lastAnimation + 3000)) {
                log("Less than 3 seconds ago animating " + System.currentTimeMillis());
                return true;

            } else if (System.currentTimeMillis() > (lastAnimation + 3000)) {
                log("Longer than 3 seconds ago animating" + System.currentTimeMillis());
                return false;
            }
            else {
                log("not animating");
                return false;
            }
        }

 

1 minute ago, The Undefeated said:

I could but when I use ConditionalSleep I can't run my AntiBan method so that's not practical.

I logged the state of my code and something is completely wrong.


[INFO][Bot #1][02/25 08:40:10 PM]: Animating 				1488051610387
[INFO][Bot #1][02/25 08:40:10 PM]: Animating 				1488051610654
[INFO][Bot #1][02/25 08:40:10 PM]: Less than 3 seconds ago animating 	1488051610920
[INFO][Bot #1][02/25 08:40:11 PM]: Less than 3 seconds ago animating	1488051611216
[INFO][Bot #1][02/25 08:40:11 PM]: Longer than 3 seconds ago animating	1488051611773
[INFO][Bot #1][02/25 08:40:11 PM]: STRING
[INFO][Bot #1][02/25 08:40:12 PM]: Animating 				1488051612064

As soon as my player stops animating it will check if it stopped animating 3 seconds ago. I posted the ms time with it and as you can see between "animating" and "longer than 3 seconds ago " is a difference of 1119 ms which is not 3000ms. I have no idea why it still outputs that it's longer than 3 seconds ago.

 


    private long lastAnimation;

        private boolean isFletching() throws InterruptedException {

            sleep(random(200,300));
            if (myPlayer().isAnimating()) {
                lastAnimation = System.currentTimeMillis();
                log("Animating " + System.currentTimeMillis());
                return true;
            } else if (System.currentTimeMillis() < (lastAnimation + 3000)) {
                log("Less than 3 seconds ago animating " + System.currentTimeMillis());
                return true;

            } else if (System.currentTimeMillis() > (lastAnimation + 3000)) {
                log("Longer than 3 seconds ago animating" + System.currentTimeMillis());
                return false;
            }
            else {
                log("not animating");
                return false;
            }
        }

 

You can always run your antiban in a thread, set only to run it's loop while your status is set to fletching.

  • Author
16 minutes ago, Night said:

You can always run your antiban in a thread, set only to run it's loop while your status is set to fletching.

But as soon as it's in conditional sleep the loop won't run.

 

21 minutes ago, The Undefeated said:

But as soon as it's in conditional sleep the loop won't run.

 

The thread will continue to run during a conditional sleep, which only sleeps the main thread.

  • Author
2 hours ago, Night said:

The thread will continue to run during a conditional sleep, which only sleeps the main thread.

I tried some stuff but it's not really working out, could you send me to the right direction?

 

Yours doesn't work because your setting the var to the current time inside the loop. Initialize your variable onStart or declare it as 0. Then in the loop it will only be set to the current time after you actually animate.

  • Author
25 minutes ago, LoudPacks said:

Yours doesn't work because your setting the var to the current time inside the loop. Initialize your variable onStart or declare it as 0. Then in the loop it will only be set to the current time after you actually animate.

I tried every combination you can think of but I can still nto get it done. I tried declaring it as zero, initialize it onStart and both at the same time but none of them work for me.

Still returning that it's more than 3 seconds ago when it isn't. Even this is returning; false, more than 3 seconds ago.

   private boolean isFletching() {
        if(myPlayer().isAnimating()) {
            lastTrueTime = System.currentTimeMillis();
            log("True, player is animating");
            return true;
        }
        else if((lastTrueTime + 3000) < System.currentTimeMillis()) {
            log("false, more than 3 seconds ago");
            return false;

        } else if ((lastTrueTime + 3000) > System.currentTimeMillis()) {
            log("true, less than 3 seconds ago");
            return true;
        }
        log("false");
        return false;
    }

 

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.