Jump to content

Custom mouse movement


TheMcPker

Recommended Posts

On 7/15/2018 at 10:37 PM, IDontEB said:

Create an algorithm for a line, use that algorithm to determine all the x,y points between the start and finish. Create AWT MouseEvents for every point on the line and use getBot().sendAppletEvent(); to send them to the client.

Yo, I tried to make a basic proof of concept:

int x = 12;

@Override
public int onLoop() {
    log("loop");

    x++;
    int y = 172;

    getBot().sendAppletEvent(new MouseEvent(getBot().getCanvas(),
            MouseEvent.MOUSE_MOVED,
            System.currentTimeMillis(),
            MouseEvent.NOBUTTON,
            x, y,
            0,
            false));

    return 500;

But when I run this, nothing happens. Im debugging mouse position and mouse trail, but it stays at -1, -1. Logging just keeps saying "loop" without exceptions.

What am I doing wrong?

 

Edit:

This did work:

getBot().getMouseEventHandler().generateBotMouseEvent(MouseEvent.MOUSE_MOVED, System.currentTimeMillis(),
        0, x, y, 0, false, MouseEvent.NOBUTTON, true);

Might be inefficient for entire paths though, not sure if this is the right way to do it.

Edited by ChrisJ
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...