Files
AoEBot/aoe_start_routine.py

73 lines
1.7 KiB
Python

from pyautogui import *
import pyautogui
import keyboard
WAIT4CLICK = 0.04
import aoe_commands
import aoe_recognition
def assign_hotkeys():
pyautogui.press(',')
time.sleep(WAIT4CLICK)
pyautogui.hotkey('ctrl', '1')
time.sleep(WAIT4CLICK)
pyautogui.press('.')
time.sleep(WAIT4CLICK)
pyautogui.hotkey('ctrl', '2')
time.sleep(WAIT4CLICK)
pyautogui.press('.')
time.sleep(WAIT4CLICK)
pyautogui.hotkey('ctrl', '3')
time.sleep(WAIT4CLICK)
pyautogui.press('.')
time.sleep(WAIT4CLICK)
pyautogui.hotkey('ctrl', '4')
time.sleep(WAIT4CLICK)
def build_houses():
pyautogui.press('h')
time.sleep(WAIT4CLICK)
pyautogui.press('up')
time.sleep(0.5)
pyautogui.press('2')
time.sleep(WAIT4CLICK)
pyautogui.press('q')
time.sleep(WAIT4CLICK)
pyautogui.press('q')
time.sleep(WAIT4CLICK)
pyautogui.click(650, 90)
aoe_commands.follow_points([(800, 500)])
time.sleep(WAIT4CLICK)
pyautogui.press('3')
time.sleep(WAIT4CLICK)
pyautogui.rightClick(650, 90)
aoe_commands.follow_points([(800, 500)])
time.sleep(WAIT4CLICK)
pyautogui.press('4')
time.sleep(WAIT4CLICK)
pyautogui.press('q')
time.sleep(WAIT4CLICK)
pyautogui.press('q')
time.sleep(WAIT4CLICK)
pyautogui.click(300, 200)
aoe_commands.follow_points([(800, 500)])
time.sleep(WAIT4CLICK)
def run_start_routine():
aoe_commands.order_peasants(int(aoe_recognition.read_resources()['food'] / 50)) # each villager costs 50 gold
assign_hotkeys()
build_houses()
xxa = aoe_recognition.initial_scout_trace()
pyautogui.press('1')
pyautogui.press('1')
aoe_commands.follow_points(xxa)
pyautogui.move(-500, -500) # reset mouse
pyautogui.press('h')