gamerboyusbc Posted June 24, 2020 Share Posted June 24, 2020 I am trying to record mouse movements and clicks generated by the bot. I can record mouse movements easily enough using the getMouse().getPosition() I am having issues however finding the way to get mouse clicks. Normally this is done implementing a MouseListener interface but everything I can find in the forums relates to listening to mouse clicks from human input which I can do easily enough. If your curious as to why I want to do this, its because I want to give my scripts some level of event prediction. What I mean by that is lets say your stringing yew bows... you must have the bank closed before stringing your next set... normally you'd have the bot wait for the window to close and then you'd move the mouse to the inventory to begin those interaction events. A human might begin moving the mouse even before the client knows the bank window is closed. If you could record how the bot is interacting you could playback those recordings in an async thread in much the same way a mouse recorder would, but removing idle mouse movement. Any comments or suggestions would be great! Quote Link to comment Share on other sites More sharing options...
BravoTaco Posted June 24, 2020 Share Posted June 24, 2020 (edited) In the situation of closing the bank, and moving the mouse to the inventory before the bank is closed or as soon as you click close. You could just use widgets to get the close button, interact with the widget and right after interacting with no sleeps just move the mouse over to whatever inventory slot you want. Than wait until the interface is closed before interacting with the inventory item. Edited June 24, 2020 by BravoTaco Quote Link to comment Share on other sites More sharing options...
gamerboyusbc Posted June 24, 2020 Author Share Posted June 24, 2020 (edited) 5 hours ago, BravoTaco said: In the situation of closing the bank, and moving the mouse to the inventory before the bank is closed or as soon as you click close. You could just use widgets to get the close button, interact with the widget and right after interacting with no sleeps just move the mouse over to whatever inventory slot you want. Than wait until the interface is closed before interacting with the inventory item. BravoTaco, Hey, thanks for your reply. I definitely can come up with solutions to some (or maybe even all) of the issues that I run into in reaction based scripts. I would like to create an elegant solution that would allow the script to record itself, run the recording through an algorithm to smooth out the script, then playback the recording while the script monitors the progress. This could be used anywhere there is repetitive tasks. Imagine runecrafting... the macro could allow the mouse to begin moving to where the alter is even before the player has teleported. A human running runes would do that... To make this work though I need to be able to record mouse and keyboard events and therein lies the problem I am trying to solve. Edited June 24, 2020 by gamerboyusbc grammer Quote Link to comment Share on other sites More sharing options...
BravoTaco Posted June 24, 2020 Share Posted June 24, 2020 (edited) Hmmm, you could create a wrapper for when you use the interact() method, so when the interact() returns true than you know it clicked. EX. Might cause problems if the bot had to right click to interact with it though. private Point interact(Entity entity) { Point clickedPoint = null; if (entity.interact()) clickedPoint = getMouse().getPosition(); return clickedPoint; } Edited June 24, 2020 by BravoTaco Quote Link to comment Share on other sites More sharing options...