commit b4602ec314478caf4f9a3783401c1bf68aac0974 Author: Sheldon Date: Fri Feb 19 18:32:20 2021 +0800 fist commit diff --git a/FreeCompany.png b/FreeCompany.png new file mode 100644 index 0000000..762ff6a Binary files /dev/null and b/FreeCompany.png differ diff --git a/FreeCompanyAlt.png b/FreeCompanyAlt.png new file mode 100644 index 0000000..390797b Binary files /dev/null and b/FreeCompanyAlt.png differ diff --git a/PurchaseLand.png b/PurchaseLand.png new file mode 100644 index 0000000..6cd7837 Binary files /dev/null and b/PurchaseLand.png differ diff --git a/Yes.png b/Yes.png new file mode 100644 index 0000000..314c68f Binary files /dev/null and b/Yes.png differ diff --git a/mouse_macro.py b/mouse_macro.py new file mode 100644 index 0000000..e6ec601 --- /dev/null +++ b/mouse_macro.py @@ -0,0 +1,44 @@ +from pyautogui import * +import time + +def locateClick(imgname, alt=None, t=0.1, button="left"): + time.sleep(t) + box = locateOnScreen(imgname) + print(imgname, "found at: ", box) + + if box is None: + if alt is not None: + locateClick(alt, button=button) + return False + + x, y = box.left + box.width/2, box.top + box.height/2 + moveTo(x, y) + longClick(button=button) + return True + +def longClick(t=0.100, button="left"): + mouseDown(button=button) + time.sleep(t) + mouseUp(button=button) + +count = 1; +while(True): + #if count%5 == 0: time.sleep(5); + + # get center of screen + start_x, start_y = size() + start_x /= 3; + start_y /= 2; + + moveTo(start_x, start_y) + click(); + longClick(button="right") + + if not locateClick("PurchaseLand.png", t=0.3): + press("esc"); + continue + if not locateClick("FreeCompanyAlt.png", "FreeCompany.png"): pass + if not locateClick("Yes.png"): pass + count += 1; + +