Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Question Is there an alternative to Animation IDs for getting the player's action?

Super Bot Author
Joined
Jun 24, 2016
Messages
151
I have noticed that RuneScape sometimes changes the Animation IDs for actions. I currently have 3 Animation IDs in my code that all correspond to mining, and every time I find a new one, I have to add it to my code. Is there a better way to determine the player's current action (like mining, woodcutting, etc.) than using Animation IDs? I'm asking because it's possible that there are other Animation IDs for an action that I will never find, but users of my bots will have, and then the bot would malfunction for them.
 
Go check out new bots and give helpful feedback.
Joined
Jan 31, 2016
Messages
5,413
I have noticed that RuneScape sometimes changes the Animation IDs for actions. I currently have 3 Animation IDs in my code that all correspond to mining, and every time I find a new one, I have to add it to my code. Is there a better way to determine the player's current action (like mining, woodcutting, etc.) than using Animation IDs? I'm asking because it's possible that there are other Animation IDs for an action that I will never find, but users of my bots will have, and then the bot would malfunction for them.

When mining or doing any tasks the player is animating (.getNimationId ()) returns -1 I believe. But when the player is animating the Id will be something else. You really shouldn't need to use specific id's but rather just check if it is -1.
If this has to do with mining, .isValid () works like a charm, and paired with the animationID is sure to work. Just give more details if this is not what you are asking about. I am a bit confused by what you want
 
I've been called a god before.
Joined
Aug 5, 2014
Messages
3,212
I have noticed that RuneScape sometimes changes the Animation IDs for actions. I currently have 3 Animation IDs in my code that all correspond to mining, and every time I find a new one, I have to add it to my code. Is there a better way to determine the player's current action (like mining, woodcutting, etc.) than using Animation IDs? I'm asking because it's possible that there are other Animation IDs for an action that I will never find, but users of my bots will have, and then the bot would malfunction for them.
iirc getTarget() returns the object we are interacting with.
 
Client Developer
Joined
Oct 12, 2015
Messages
3,781
To be honest, all you have to do is check to see if you're animating (eg != -1). Don't have to check for specific animations.

When mining or doing any tasks the player is animating (.getNimationId ()) returns -1 I believe. But when the player is animating the Id will be something else. You really shouldn't need to use specific id's but rather just check if it is -1.
If this has to do with mining, .isValid () works like a charm, and paired with the animationID is sure to work. Just give more details if this is not what you are asking about. I am a bit confused by what you want

Other way round - if you AREN'T animating, your animation ID is -1.
 
Super Bot Author
Joined
Jun 24, 2016
Messages
151
When mining or doing any tasks the player is animating (.getNimationId ()) returns -1 I believe. But when the player is animating the Id will be something else. You really shouldn't need to use specific id's but rather just check if it is -1.
If this has to do with mining, .isValid () works like a charm, and paired with the animationID is sure to work. Just give more details if this is not what you are asking about. I am a bit confused by what you want
Sorry for not being clear, but I currently use Animation IDs to make sure that the bot is mining and to make sure that it didn't misclick and start chopping down a tree or something.
Code:
// if the player is mining (as opposed to woodcutting or something (don't wait for misclicks))
switch (Players.getLocal().getAnimationId()) {
    case 624:
    case 627:
    case 629:
        // wait until the ore is gone. this means that either the player or another player took it
        Execution.delayUntil(() -> !oreBeingMined.isValid());
        break;
}
I guess I could use getTarget as @Qosmiof2 suggested:
Code:
if (Players.getLocal().getAnimationId() != -1) {
    if (Players.getLocal().getTarget() == oreBeingMined) {
        Execution.delayUntil(() -> !oreBeingMined.isValid());
    }
}
This new code also has the added bonus of making sure that the bot is mining the correct rock. Thanks for all of your help everyone :)

EDIT:
I didn't check the API for information about getTarget(). It returns an Actor, when I need to check if the bot is interacting with a GameObject, so it doesn't work in this case.
 
Last edited:
Go check out new bots and give helpful feedback.
Joined
Jan 31, 2016
Messages
5,413
Sorry for not being clear, but I currently use Animation IDs to make sure that the bot is mining and to make sure that it didn't misclick and start chopping down a tree or something.
Code:
// if the player is mining (as opposed to woodcutting or something (don't wait for misclicks))
switch (Players.getLocal().getAnimationId()) {
    case 624:
    case 627:
    case 629:
        // wait until the ore is gone. this means that either the player or another player took it
        Execution.delayUntil(() -> !oreBeingMined.isValid());
        break;
}
I guess I could use getTarget as @Qosmiof2 suggested:
Code:
if (Players.getLocal().getAnimationId() != -1) {
    if (Players.getLocal().getTarget() == oreBeingMined) {
        Execution.delayUntil(() -> !oreBeingMined.isValid());
    }
}
This new code also has the added bonus of making sure that the bot is mining the correct rock. Thanks for all of your help everyone :)
My bad for saying the opposite of what i meant lol, i figured it was for mining. And that is why i recommended the != -1 check.

Take this piece of code, i forget who gave it to me, but nice to call :D

Code:
 public boolean isAnimating() {
        Player me = Players.getLocal();
        if (me != null) {
            System.out.println("Animating");
            System.out.println(me.getAnimationId());
            return me.getAnimationId() != -1;
        }
        return true;
    }

Any questions on mining, hit me up :D I got some experience with the lovely struggles, just not much in rs3.
 
I've been called a god before.
Joined
Aug 5, 2014
Messages
3,212
You are complicating boys.

Code:
public boolean isAnimating(){
return Players.getLocal().getAnimationID() != -1;
}
 
Super Bot Author
Joined
Jun 24, 2016
Messages
151
iirc getTarget() returns the object we are interacting with.
I just looked into getTarget() some more after a user of my bot complained about doubleclicking. According to the API, it returns the Actor that the player is targeting (if any). This doesn't work for skilling as a player interacts with GameObjects when skilling, not Actors. Does anyone know if there is another answer to my original question or if there is an alternative to getTarget() that works for GameObjects. I checked the API and looked around in the Developer's Toolkit and couldn't find any.
 
I've been called a god before.
Joined
Aug 5, 2014
Messages
3,212
I just looked into getTarget() some more after a user of my bot complained about doubleclicking. According to the API, it returns the Actor that the player is targeting (if any). This doesn't work for skilling as a player interacts with GameObjects when skilling, not Actors. Does anyone know if there is another answer to my original question or if there is an alternative to getTarget() that works for GameObjects. I checked the API and looked around in the Developer's Toolkit and couldn't find any.
I posted a boolean above i think
 
Client Developer
Joined
Oct 12, 2015
Messages
3,781
You'll need to do some data gathering and manually collect all animation IDs into a list/array and check against that list.
 
Super Bot Author
Joined
Jun 24, 2016
Messages
151
You'll need to do some data gathering and manually collect all animation IDs into a list/array and check against that list.
Ugh, that's what I was doing before lol.
Sorry for not being clear, but I currently use Animation IDs to make sure that the bot is mining and to make sure that it didn't misclick and start chopping down a tree or something.
Code:
// if the player is mining (as opposed to woodcutting or something (don't wait for misclicks))
switch (Players.getLocal().getAnimationId()) {
    case 624:
    case 627:
    case 629:
        // wait until the ore is gone. this means that either the player or another player took it
        Execution.delayUntil(() -> !oreBeingMined.isValid());
        break;
}
It looks like I'm gonna have to do it this way. I just hope that Jagex doesn't change the Animation IDs too often.
 
Joined
Dec 10, 2014
Messages
3,332
You could probably check if the animation is not -1, if the object is valid, if you're next to the object and if you're facing it.
 
Top