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
  • npc.Interact with moving npc


    DaffyDubz
     Share

    Recommended Posts

    So I've noticed a strange thing when trying to use npc.interact("Attack") if the npc is moving. The mouse moves to the npc, and follows the npc kind of spaz-like for a few seconds before either clicking it finally or giving up and finding another npc. This only happens maybe once out of 10 or 15 interacts, so it's not really a huge deal, but I was curious as to why this was happening?

    Is there another built-in method in the API that can accomplish this a little smoother or am I using it incorrectly, or do I need to build a custom click function or something? My guess is my sleepuntil is causing issues? I'd assume the npc.intereact() would return false if it couldn't interact, but does it still move the mouse? (Side question, is the source for various methods like this available anywhere? The java docs don't really explain the details I need, even just sudo would be helpful so I can understand all of it's functionality, because it's obviously not just checking if the npc has an interact option, it's doing mouse movements and clicks, possibly reading the text in the upper-left when the mouse is hovering over the npc? Speaking of that, side side question, how can I read that text in the upper-left hand corner when mouse is hovering an object?)

    NPC currentNpc = getNpcs().closest(FiterStuff...)
    
    if(currentNpc != null && currentNpc.interact("Attack")) { 
    	MethodProvider.sleepUntil(() -> getLocalPlayer().isInCombat() 
    		|| getLocalPlayer().getInteractingCharacter() != null,     // this is ok, right? wait until something is interacting with us
    		(long) Calculations.random(2500,4600)); 
    }

    Thanks in advanced!

    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.