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
  • Require help with nearby players.


    Deep Slayer

    Recommended Posts

    Hey guys,

    I'm trying to  move the mouse and hover  over nearby players without clicking on them. (or only right clicking on them)

    which classes and methods would I use to go about this? 

     

    appreciate any help thanks!

    Link to comment
    Share on other sites

    Thanks for the reply Hashtag.

     

    Im sure the methods are correct with mouse move. I’m just not sure what type of object you use to grab other players as an entity. For instance Gameobjects for objects. NPC for npc’s etc. 

    I’m sure it’s a simple 1 line of code or whatever to grab the player or a random player which ever way you want to sort. and then  move the mouse over them 

    Link to comment
    Share on other sites

    Thanks for your replies. 

    I’m pretty new to scripting. Please forgive my ignorance but I  don’t understand how to use the EntityDestination class just from reading it. I’m not sure how I would implement it to get other players around me. 
     

    I think it would be really helpful to see it in a bit of code as to how it works if anybody knows? 

     

    thanks hashtag and thecloakdone! 

     

    Link to comment
    Share on other sites

    EntityDestination has nothing to do with getting players around you. What Cloakd posted does that. Basically what you want is

    List<Player> allNearbyPlayers = Players.all(); // Get all nearby players, you could filter your player out
    if (allNearbyPlayers.size() > 0) { // Ensure there are players near you
      Player randomPlayer = allNearbyPlayers.get(Calculations.random(allNearbyPlayers.size()); // Select a random player
      EntityDestination playerDestination = new EntityDestination(randomPlayer); // Create a destination for the player
      Mouse.move(playerDestination); // Hover the player
      Mouse.click(playerDestination, ClickMode.RIGHT_CLICK); // Right click the player
    }

    Filtering your own player out of the list and selecting an optimal player (not just random) to inspect, I'll leave those for you to figure out.

    Link to comment
    Share on other sites

    Thank you hash! this has been very helpful!

     

    EDITED:

    pretty sure something like this will filter the local player out.

    List<Player> allNearbyPlayers = Players.all();
    allNearbyPlayers.remove(getLocalPlayer());
    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • 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.