1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Request Information about interactions from API

Discussion in 'Client & Site Suggestions' started by miniwa, Jul 20, 2018.

  1. miniwa

    Joined:
    Jul 16, 2018
    Messages:
    8
    Likes Received:
    0
    Don't know if this has been brought up before, but in osbot/tribot APIs you can access information about interactions.
    Ex: Whether an NPC is interacting with you, which NPC/Player a character is interacting with, what characters are attacking you, etc.

    Tribot example:
    RSCharacter
    RSCharacter
    Combat

    Is there a reason this information is not in RuneMate API?
    It would be a good addition if not, especially for combat bots.
     
  2. Negrita

    Joined:
    Jan 28, 2017
    Messages:
    491
    Likes Received:
    183
    Do you mean
    Code (Text):
    1. Players.getLocal().getTarget()
     
    Derk and CuppaJava like this.
  3. miniwa

    Joined:
    Jul 16, 2018
    Messages:
    8
    Likes Received:
    0
    Yep, thanks.
    Still would be nice with extra combat methods though.
     
  4. Negrita

    Joined:
    Jan 28, 2017
    Messages:
    491
    Likes Received:
    183
    Yeah is Players.getLocal().isInCombat() would be nice
     
  5. Snufalufugus

    Joined:
    Aug 23, 2015
    Messages:
    1,961
    Likes Received:
    757
    You can make all of these methods yourself in 3 minutes if you want them.
     
  6. miniwa

    Joined:
    Jul 16, 2018
    Messages:
    8
    Likes Received:
    0
    I could recreate the entire bot too if I wanted to.
    Stupid argument.
     
  7. Snufalufugus

    Joined:
    Aug 23, 2015
    Messages:
    1,961
    Likes Received:
    757
    There are probably less than a dozen people on this platform who know the entirety of the Runemate API. Adding more methods that just combine existing ones would make the API bloat magnitudes worse.

    I also really doubt you could :rolleyes:
     
    Derk and CuppaJava like this.
  8. auxi

    Joined:
    May 24, 2016
    Messages:
    1,113
    Likes Received:
    990
    I don't see the point of these methods officially in the API either, isInCombat is literally just getTarget() != null. If you think isInCombat looks better then you should just make a method for it like Snuf mentioned.
     
  9. miniwa

    Joined:
    Jul 16, 2018
    Messages:
    8
    Likes Received:
    0
    There are plenty of methods that combine existing ones already. Moving to the closest bank just builds on top of navigation and GameObject scanning, clicking just builds on menu interactions and mouse api, etc etc. What the difference with this one?

    Well, no. :( I was trying to make a point.

    Because it serves as in-code documentation, which is good when actual documentation is lacking. player.getTarget() != null is not very obvious at first glance whereas player.isInCombat() is very hard to not understand.
    And obviously, it saves having to rewrite code.
     
  10. auxi

    Joined:
    May 24, 2016
    Messages:
    1,113
    Likes Received:
    990
    In my opinion, getTarget() != null should be fairly obvious for any person with basic Java knowledge. I understand your point though, I've seen a few people throughout my time request the same thing, just not sure if I agree it's necessary.
     
  11. Negrita

    Joined:
    Jan 28, 2017
    Messages:
    491
    Likes Received:
    183
    Actually getTarget() isn't close to when you are in combat. You need to combine
    • Check for target
    • Check for animation
    • Check for animation from target
    then it still messes up sometimes.
    There's a reason why a lot of the combat bots in the store mass spam NPCs while they are doing their death animation.

    Wouldn't be bad to just have one standardized way of checking whether your still under attack.


    I agree with Snufalufugus it only takes a couple of minutes and test runs to figure it out. Once you have it, you're set. But something as straight forward as checking "is in combat" shouldn't require that imo. And it could be confusing towards a lot of unexperienced developers
     
  12. auxi

    Joined:
    May 24, 2016
    Messages:
    1,113
    Likes Received:
    990
    I agree getTarget() is wacky and can break often on RS3, but on OSRS I can't see there being any issues. If you find yourself needing animations for both your local player and target npc to determine if you are in combat, you are doing something wrong.
     
  13. Negrita

    Joined:
    Jan 28, 2017
    Messages:
    491
    Likes Received:
    183
    I made a crappy OSRS fishing/cooking/combat bot for myself a long time ago. Getting it to attack correctly was a headache. Especially because I just got into writting bots again.
    Using bots from the store, they nearly all mass click NPCs at some point or try to attack when still in combat.
     
  14. auxi

    Joined:
    May 24, 2016
    Messages:
    1,113
    Likes Received:
    990
  15. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    The reason it's not in the API is because being in combat is not a property of the client.

    There simply is no standardized way
     
    Negrita likes this.
  16. miniwa

    Joined:
    Jul 16, 2018
    Messages:
    8
    Likes Received:
    0
    Couldn't you check the visibility of the health bar? I think that's how tribot does it at least.
     
  17. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    Then poison damage or falling off agility courses would count as being in combat.
     
  18. miniwa

    Joined:
    Jul 16, 2018
    Messages:
    8
    Likes Received:
    0
    Yeah but I think if one checks for at least one nearby NPC where npc.getTarget() == localPlayer && NPC.isHealthbarVisible(), that would be reasonably accurate.
     
  19. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    That NPC could be a follower like a pet.
    Just accept that there is no universal way to tell if an Actor is in combat that's also within reasonable bounds of complexity.
    Make a method on your own that works for your case instead.
     
    miniwa likes this.

Share This Page

Loading...