Answer the question
In order to leave comments, you need to log in
Can the robot not have time to complete its actions, and move on to the next task?
Hello, I am writing a bot for the game, for this I create three threads, one reads the log (messages that the bot must process come there), the second processes the message (decides what to do) and puts it in the queue, and the third takes the processed message from the queue, and starts its execution, and along the way, other tasks are added to the queue.
In the third thread, I actively use the Robot class to set the cursor to the desired coordinates and perform actions.
public static void dropToStashFromInventory(){
try {
closeAllWindows();//закрывает открытые окна в игре
Robot robot = new Robot();
robot.mouseMove(977, 486); //открывает сундук
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
//x=1316, y=588 1 inventory slot
for (int i = 0;i<12;i++){//тут бежит по всем слотам инвентаря 12х5
robot.mouseMove(1316 + (50 *i), 578);
for (int j = 0; j<5;j++){
robot.mouseMove(1316 + (50 * i), 578 + (50 * j));
robot.keyPress(KeyEvent.VK_CONTROL);//зажимая control и кликая на слот
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
robot.keyRelease(KeyEvent.VK_CONTROL);
}
}
} catch (AWTException e) {
e.printStackTrace();
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question