from pyautogui import * import pyautogui import keyboard import win32api, win32con WAIT4CLICK = 0.001 def click(x,y): win32api.SetCursorPos((x,y)) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0) def right_click(x,y): win32api.SetCursorPos((x,y)) win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN,0,0) win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP,0,0) def order_peasants(number): print(f"Trying to order {number} peasants.") select_town_center() for i in range(number): pyautogui.press('q') time.sleep(WAIT4CLICK) def select_town_center(): pyautogui.press('h') time.sleep(WAIT4CLICK) def follow_points(points): pyautogui.keyDown('shift') for x,y in points: #pyautogui.rightClick(x,y) right_click(x,y) time.sleep(WAIT4CLICK) pyautogui.keyUp('shift')