Speed up pathing, read resources

This commit is contained in:
2020-11-09 22:32:46 +01:00
parent 7f731cb9fd
commit 07a61008ad
4 changed files with 81 additions and 8 deletions

View File

@@ -1,8 +1,19 @@
from pyautogui import *
import pyautogui
import keyboard
import win32api, win32con
WAIT4CLICK = 0.04
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.")
@@ -18,7 +29,8 @@ def select_town_center():
def follow_points(points):
pyautogui.keyDown('shift')
for x,y in points:
pyautogui.rightClick(x,y)
#pyautogui.rightClick(x,y)
right_click(x,y)
time.sleep(WAIT4CLICK)
pyautogui.keyUp('shift')
pyautogui.move(-500, -500) # reset mouse