Wilmantuxas 2 Posted August 24, 2024 Share Posted August 24, 2024 (edited) Hey, I can't seem to get the hang of how to use the `.hover(action)` methods. The way I want to use them is to hover an action on an object and then click it after some condition has been met or after some delay, but if I use the same object for the `.click(action)` method where the action was already hovered, the mouse attempts to right-click the target again. e.g.: Query.gameObjects().findFirst().ifPresent { it.hover("Reset") Waiting.wait(2000) it.click("Reset") } The code above will result in the mouse first hovering the Reset action on an object, and then after two seconds, right-clicking the object again and moving it to the same action, but this time actually clicking it. What am I doing wrong here? How is the hover(action) method supposed to be used? Any help is much appreciated 🙇 Edited August 25, 2024 by Wilmantuxas Quote Link to comment Share on other sites More sharing options...
Pow4Life181 1 Posted August 25, 2024 Share Posted August 25, 2024 This is working just fine for me with a basic Tree - Right-Clicks and hovers over "Examine" for 2 seconds and then clicks it. Query.gameObjects() .nameEquals("Tree") .findClosestByPathDistance() .ifPresent { it.hover("Examine") Waiting.wait(2000) it.click("Examine") } What object(s) are you having trouble with? Quote Link to comment Share on other sites More sharing options...
Wilmantuxas 2 Posted August 26, 2024 Author Share Posted August 26, 2024 (edited) Virtualy everything. Hover seems to just hover the action but I have no ability to click the action afterwards via the SDK Even with this snippet - it first hovers the 'examine' action and then after the two seconds it right-clicks the object again but this time actually clicks the 'examine'. Added a gif of how it looks for me after running the code here: Query.gameObjects().nameEquals("Loot Chest").findClosestByPathDistance().ifPresent { it.hover("Examine") Waiting.wait(2000) it.click("Examine") } www.mp4 Edited August 26, 2024 by Wilmantuxas Quote Link to comment Share on other sites More sharing options...
Pow4Life181 1 Posted August 26, 2024 Share Posted August 26, 2024 I really wish I had gotten a gif of it working with a Tree yesterday because I am seeing the same behavior as you now with the Loot Chest (and Tree.) Quote Link to comment Share on other sites More sharing options...
Jamie 610 Posted August 27, 2024 Share Posted August 27, 2024 You'll probably need to make your own method with ChooseOption. Quote Want to view my scripts? Search "Jamie" in the repository! If you need support, you can join my support discord by clicking the link below or sending me a PM. Link to comment Share on other sites More sharing options...
Wilmantuxas 2 Posted August 27, 2024 Author Share Posted August 27, 2024 12 hours ago, Jamie said: You'll probably need to make your own method with ChooseOption. How would I go about doing that? Given that the `.click` and `.interact` methods both make the mouse right-click the object again? AFAIK there's no way of forcing the mouse to click where it's at via the SDK? I know that legacy sdk allows the `Mouse.click(1)` method, but I'd prefer to keep working with the SDK. https://runeautomation.com/docs/sdk/kdocs/-tribot--scripting--s-d-k/org.tribot.script.sdk.input/-mouse/index.html Quote Link to comment Share on other sites More sharing options...
Jamie 610 Posted August 28, 2024 Share Posted August 28, 2024 You'll need to use Mouse.click Quote Want to view my scripts? Search "Jamie" in the repository! If you need support, you can join my support discord by clicking the link below or sending me a PM. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.