Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • getLocalPlayer().isInCombat() bug


    kamilo
     Share

    Recommended Posts

    Encountered this wierd glitch it was fucking up my script, then went ahead and de-bugged the method and found problems in that

    so, when a player 'sends a trade' to another player; i.e. message in chatbox appears 'sending trade offer'

    the boolean getLocalPlayer().isInCombat() becomes true for a bit

    then becomes false? lmfao can't believe this is even a thing please fix

    Link to comment
    Share on other sites

    When the trade is open it sets to false again, i've noticed it only turns to true momentarily after the message 'Sending trade offer..." appears in the Game Messages.

    Link to comment
    Share on other sites

    😕 unfortunate, although for now, I can think of some ways around this. One would be to check for the combat time to negate the short incombat status you referred to like so.

    if (getLocalPlayer().getCombatTime() > x && getLocalPlayer().isInCombat()) {
    }

    or just simply check if the trade window is open in case the problem is that your player is incombat whilst trading.

    if (getLocalPlayer().isInCombat() && !getTrade().isOpen()) {
    }

    or in case its just the message that procs isInCombat to be true use the advanced message listener described in this thread:

     

    Link to comment
    Share on other sites

    51 minutes ago, Lyuda said:

    😕 unfortunate, although for now, I can think of some ways around this. One would be to check for the combat time to negate the short incombat status you referred to like so.

    if (getLocalPlayer().getCombatTime() > x && getLocalPlayer().isInCombat()) {
    }

    or just simply check if the trade window is open in case the problem is that your player is incombat whilst trading.

    if (getLocalPlayer().isInCombat() && !getTrade().isOpen()) {
    }

    or in case its just the message that procs isInCombat to be true use the advanced message listener described in this thread:

     

    naw it appears when you trade someone, it sets to false when the trade it open

    so when my character clicks trade with, message appears in chat 'sending trade offer...' that triggers the boolean to set true

    it doesn't affect the person accepting the trade, althoughi think when you accept the trade offer through the game messages, the sending trade offer message also appears and triggers the boolean again. so would probably have to listen to game message and do if (isInCombat() && !getMessage.contains("Sending trade offer...")) 

    Link to comment
    Share on other sites

    1 minute ago, kamilo said:

    naw it appears when you trade someone, it sets to false when the trade it open

    so when my character clicks trade with, message appears in chat 'sending trade offer...' that triggers the boolean to set true

    it doesn't affect the person accepting the trade, althoughi think when you accept the trade offer through the game messages, the sending trade offer message also appears and triggers the boolean again. so would probably have to listen to game message and do if (isInCombat() && !getMessage.contains("Sending trade offer...")) 

    Yeah, in that case the only solution I can think of is to use the message listener. Someone is making a muling script 😜 

    Link to comment
    Share on other sites

    25 minutes ago, Lyuda said:

    Yeah, in that case the only solution I can think of is to use the message listener. Someone is making a muling script 😜 

    55MWqhs.png

    Link to comment
    Share on other sites

    As Pseudo said, we check against isInteracting on some cases, because combat timer (if I'm remembering correctly) goes off of you being hit, not you hitting something else.
    So for instance, safespotting, we can't check strict combat based variables.

    I can't think of very many instances where you're going to need a distinct "trade but do something else if I'm in combat between the point of me interacting and me opening the trade window" so it's not really a bug I'm overly concerned about.

    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.