Changed formatting, and image pathes.

This commit is contained in:
Sheldon 2021-02-19 19:38:41 +08:00
parent c3c79d5bb5
commit cf3b5bcd17
5 changed files with 16 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

BIN
Yes.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -12,7 +12,7 @@ def locate_click(imgname, alt=None, t=0.1, button="left"):
# Try to find image from screengrab.
box = locateOnScreen(imgname)
print(imgname, "found at: ", box)
print(imgname, "found at:\n\t", box)
# It not found, try to find alt image.
if box is None:
@ -36,6 +36,18 @@ def long_click(t=0.100, button="left"):
# Main logic.
#
# Define image paths:
img_dir = "img/"
img_purchaseland = img_dir+"PurchaseLand.png"
img_purchaseland_alt = None;
img_freecompany = img_dir+"FreeCompany.png"
img_freecompany_alt = img_dir+"FreeCompanyAlt.png"
img_yes = img_dir+"Yes.png"
img_yes_alt = None;
count = 1;
while(True):
# Option to pause every 5 iteratons to stop program
@ -52,15 +64,14 @@ while(True):
long_click(button="right")
# Attempt to find gui buttons.
if not locate_click("PurchaseLand.png", t=0.3):
if not locate_click(img_purchaseland, img_purchaseland_alt, t=0.35):
press("esc");
continue
if not locate_click("FreeCompanyAlt.png", "FreeCompany.png"):
if not locate_click(img_freecompany_alt, img_freecompany):
press("esc");
press("esc");
continue
if not locate_click("Yes.png"):
press("esc");
if not locate_click(img_yes, img_yes_alt):
press("esc");
press("esc");
continue