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

Discussion in 'Developer Support' started by SuperBotter, Aug 6, 2016.

  1. 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.
  2. 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
  3. iirc getTarget() returns the object we are interacting with.
  4. 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.

    Other way round - if you AREN'T animating, your animation ID is -1.
  5. 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 (Text):
    1. // if the player is mining (as opposed to woodcutting or something (don't wait for misclicks))
    2. switch (Players.getLocal().getAnimationId()) {
    3.     case 624:
    4.     case 627:
    5.     case 629:
    6.         // wait until the ore is gone. this means that either the player or another player took it
    7.         Execution.delayUntil(() -> !oreBeingMined.isValid());
    8.         break;
    9. }
    I guess I could use getTarget as @Qosmiof2 suggested:
    Code (Text):
    1. if (Players.getLocal().getAnimationId() != -1) {
    2.     if (Players.getLocal().getTarget() == oreBeingMined) {
    3.         Execution.delayUntil(() -> !oreBeingMined.isValid());
    4.     }
    5. }
    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 :)

    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.
    #5 SuperBotter, Aug 11, 2016
    Last edited: Aug 17, 2016
    Qosmiof2 likes this.
  6. 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 (Text):
    1.  public boolean isAnimating() {
    2.         Player me = Players.getLocal();
    3.         if (me != null) {
    4.             System.out.println("Animating");
    5.             System.out.println(me.getAnimationId());
    6.             return me.getAnimationId() != -1;
    7.         }
    8.         return true;
    9.     }
    Any questions on mining, hit me up :D I got some experience with the lovely struggles, just not much in rs3.
  7. You are complicating boys.

    Code (Text):
    2. public boolean isAnimating(){
    3. return Players.getLocal().getAnimationID() != -1;
    4. }
    Serene likes this.
  8. 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.
  9. I posted a boolean above i think
  10. You'll need to do some data gathering and manually collect all animation IDs into a list/array and check against that list.
  11. Ugh, that's what I was doing before lol.
    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.
  12. @SuperBotter Please go on teamviewer with me :D and let me try to help you!
  13. 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.

Share This Page