forum

Java robot class doesnt work with osu! (resolved)

posted
Total Posts
4
Topic Starter
Miterosan
public static void main(String[] args) throws InterruptedException {
Scanner scan;
scan = new Scanner(System.in);


//create robot
Robot robot = null;
try {
robot = new Robot();
} catch (AWTException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}



try {
//connect to my phonees ip/port
Socket kkSocket = new Socket("192.168.178.28", 4123);
PrintWriter out = new PrintWriter(kkSocket.getOutputStream(), true);
BufferedReader in = new BufferedReader(
new InputStreamReader(kkSocket.getInputStream()));
//infinite loop that waits for incoming numbers
while(true){
String str = in.readLine();
//if my phone sends a "1" i should press a and so on
if (str.equals("1")){robot.keyPress(KeyEvent.VK_A);}
if (str.equals("2")){robot.keyPress(KeyEvent.VK_B);}
if (str.equals("3")){robot.keyPress(KeyEvent.VK_C);}
if (str.equals("4")){robot.keyPress(KeyEvent.VK_D);}
System.out.println(str);
}


} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Buuuut It doest work at osu ... why?
At erery programm the input works but Osu! :/
Should i post this at bug report too?

Edit: Yes I know that it is wrong to throw over the main method
quaternary
Maybe the error is in how it connects to your phone, try a different method of sending keys.

If that doesn't work it's probably an anti-cheating measure.
Topic Starter
Miterosan

tuddster wrote:

Maybe the error is in how it connects to your phone, try a different method of sending keys.

If that doesn't work it's probably an anti-cheating measure.
The connection isnt the problem, the number are send correctly to my pc and on every other application a a appears in the textbox if i send the number. :/
And yeah it may be a anti cheat measure. But that would mean I can throw away my project: playing taiko with my phone ... :/
Topic Starter
Miterosan
omg i got it working by putting a delay for the keypress <3
I will release it when the app part of this stops spamming the number for some reasons
Please sign in to reply.

New reply