javamousepress

Autoclicker in Java for Skyrim


The program should do mouse clicks with a break in Skyrim.

It works fine but until I open the game it doesn't do mouse clicks, if I switch to windows it does work again. I don't understand why?

This is my code:

import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.InputEvent;

public class AutoClicker{

public AutoClicker(){
    try {
        Robot r = new Robot();
        r.mousePress(InputEvent.BUTTON1_DOWN_MASK);
        r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
        Thread.sleep(6000);
        Thread.interrupted();
    } catch (AWTException e) {
        e.printStackTrace();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

public static void main(String[] args) {
    while(true){
        new AutoClicker();
    }
}

}

Solution

  • The game has a speed limit set for the amount of time in between a click and a release. You have to r.wait() a few milliseconds in between.