import com.sun.jdi.request.MethodExitRequest;
import java.awt.*;
import java.awt.event.*;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws AWTException {
int Cooldown = 200;
int Bullets = 10000;
Scanner sc = new Scanner(System.in);
System.out.println("type 1 OR 2 to start");
int x = sc.nextInt();
if (x == 1) {
for (int i = 0; i < Bullets; i++) {
mouseclick2();
wait(Cooldown);
mouseclick3();
wait(Cooldown);
}
} else if (x == 2) {
for (int i = 0; i < Bullets; i++) {
mouseclick2();
wait(Cooldown);
mouseclick3();
wait(Cooldown);
mouseclick4();
wait(Cooldown);
}
}
}
public static void wait(int x) {
try {
Thread.sleep(x);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public static void mouseclick2() throws AWTException {
Robot bot = new Robot();
bot.keyPress(KeyEvent.VK_2);
bot.keyRelease(KeyEvent.VK_2);
}
public static void mouseclick3() throws AWTException {
Robot bot = new Robot();
bot.keyPress(KeyEvent.VK_3);
bot.keyRelease(KeyEvent.VK_3);
}
public static void mouseclick4() throws AWTException {
Robot bot = new Robot();
bot.keyPress(KeyEvent.VK_4);
bot.keyRelease(KeyEvent.VK_4);
}
}
this is a macro that I made, I want to make it so that when i press f8 it will run the first code which i made it so that i need to type 1 and for second i want to make it f9 for which i need to type 2 i tried some methods but was not able to do it correctly. I am new to stack overflow pardon me if i did not explain correctly.
New contributor
shrey200 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.