Jump to content

Bot Mouse Listener


gamerboyusbc

Recommended Posts

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!

Link to comment
Share on other sites

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 by BravoTaco
Link to comment
Share on other sites

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 by gamerboyusbc
grammer
Link to comment
Share on other sites

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 by BravoTaco
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...