Jump to content

isAnimating() is returning false during the brief period between sequence of animations


justanotherkid

Recommended Posts

while(myPlayer().isAnimating())

{

sleep(500);

}

 

or

 

new ConditionalSleep(30000)
            {
@Override
public boolean condition() throws InterruptedException 
{
return !myPlayer().isAnimating();
}
}.sleep();
 
when smelting bars these two snippets are not making the player sleep
smelts about 2 bars then loops again to reuse the bar on furnace
Link to comment
Share on other sites

make a timer, reset the timer if animating, if timer reaches x amount of time start doing the smithing stuff

ehh i think the problem here is that when you smith, you animate to put x in the furnace, and after that the player "waits" , != animating. so to add a timer for that is pretty tedious

Edited by The Hero of Time
Link to comment
Share on other sites

 

while(myPlayer().isAnimating())

{

sleep(500);

}

 

or

 

new ConditionalSleep(30000)
            {
@Override
public boolean condition() throws InterruptedException 
{
return !myPlayer().isAnimating();
}
}.sleep();
 
when smelting bars these two snippets are not making the player sleep
smelts about 2 bars then loops again to reuse the bar on furnace

 

 

 

Of course it does. You do the animation, then you stop for a split second, and do it again.

 

So waiting for the animation to stop is not a good way, because it stops after each 1 action.

Link to comment
Share on other sites

Of course it does. You do the animation, then you stop for a split second, and do it again.

 

So waiting for the animation to stop is not a good way, because it stops after each 1 action.

 

 

ehh i think the problem here is that when you smith, you animate to put x in the furnace, and after that the player "waits" , != animating. so to add a timer for that is pretty tedious

 

 

yup

Link to comment
Share on other sites

  • Developer

The mechanics of animation are like this. The way the RS client functions is that is loops on a 600ms updating interval. For animations, the client will receive information how to animate in one cycle, and although this animation may last multiple cycles, the animation update flag in the client will only be set in the cycle in which the animation will initiate. Therefor it is only reliable to know whether an animation has started and it gives you no reliable way of knowing whether an animation has ended.

 

In your specific case, a player is performing multiple animations in a row. This means that in between phases in which isAnimating() will return true, it will also return false which will break your sleep.

  • Like 1
Link to comment
Share on other sites

As many have stated previously, this is a logical error, I've posted on your original thread with the suitable fix for such an issue.

 

The brief period in between the animation actually is no animation, the animation value returns to -1, meaning the player is no longer animating. However just because the player is no longer animating, does not mean by any margin mean that the player is not actively interacting with an object or is not queued to interact with the object more.

 

I'd also recommend not sleeping your thread, that's lazy and bad practice for the solution you are looking to solve.

  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...