Deep Slayer 63 Posted February 16, 2021 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!
Hashtag 9077 Posted February 16, 2021 For example, you can use the following: https://dreambot.org/javadocs/org/dreambot/api/input/mouse/destination/impl/EntityDestination.html https://dreambot.org/javadocs/org/dreambot/api/input/Mouse.html#click-org.dreambot.api.input.mouse.destination.AbstractMouseDestination-org.dreambot.api.input.event.impl.mouse.impl.click.ClickMode- https://dreambot.org/javadocs/org/dreambot/api/input/Mouse.html#move-org.dreambot.api.input.mouse.destination.AbstractMouseDestination-
Deep Slayer 63 Author Posted February 16, 2021 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
Deep Slayer 63 Author Posted February 16, 2021 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!
Hashtag 9077 Posted February 16, 2021 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.
Deep Slayer 63 Author Posted February 16, 2021 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());
Recommended Posts
Archived
This topic is now archived and is closed to further replies.