diff --git a/tabletop_achievements/tabletop_fliptable_loop.py b/tabletop_achievements/tabletop_fliptable_loop.py index 2df7169..eeec09c 100644 --- a/tabletop_achievements/tabletop_fliptable_loop.py +++ b/tabletop_achievements/tabletop_fliptable_loop.py @@ -1,24 +1,38 @@ import pyautogui import time +# The position of the "Flip" button at the top of the screen FIRSTCLICK_X = 2300 FIRSTCLICK_Y = 70 + +# The timeout for UI elements to load (in seconds) INBETWEENSLEEPTIME = 0.2 + +# The position of the "Yes" button of the "FLip table?" prompt SECONDCLICK_X = 1760 SECONDCLICK_Y = 1140 + +# The timeout set by the game until the "Flip" button becomes clickable again (in seconds) TIMEOUTSLEEPTIME = 2 +# The amount of iterations depending on the achievement +ITERATIONS = 100 + +# initialize the counter count = 0 -time.sleep(3) +time.sleep(3) # delay to focus the game after launching the script -while True: - # Click at pixel (2300, 70) +while count < ITERATIONS: + # Click the "Flip" button pyautogui.click(FIRSTCLICK_X, FIRSTCLICK_Y) time.sleep(INBETWEENSLEEPTIME) - # Click at pixel (1760, 1140) + # Click the confirmation button pyautogui.click(SECONDCLICK_X, SECONDCLICK_Y) - time.sleep(TIMEOUTSLEEPTIME) # Wait for 3 seconds before repeating + + # update the counter and display it count += 1 print(count, end="\r") + + time.sleep(TIMEOUTSLEEPTIME) # Wait for 3 seconds before repeating diff --git a/tabletop_achievements/tabletop_savetochest_loop.py b/tabletop_achievements/tabletop_savetochest_loop.py index 4ba6fb7..689b8fd 100644 --- a/tabletop_achievements/tabletop_savetochest_loop.py +++ b/tabletop_achievements/tabletop_savetochest_loop.py @@ -2,31 +2,44 @@ import pyautogui import time import os +# The position of the right click to open the context menu for the object RIGHTCLICK_X = 1870 RIGHTCLICK_Y = 675 + +# The position of the "Save Object" option in the context menu SAVECONTEXTMENUCLICK_X = 2030 SAVECONTEXTMENUCLICK_Y = 875 + +# The position of the name input field in the "Save Object" poup NAMEFIELDCLICK_X = 1700 NAMEFIELDCLICK_Y = 1110 + +# The position of the save button in the "Save Object" popup SAVECLICK_X = 1770 SAVECLICK_Y = 1200 +# The timeout for UI elements to load (in seconds) +TIMEOUTTIME = 0.15 -time.sleep(3) +# initialize the counter +count = 0 -while True: - # Click at pixel (1870, 675) + +time.sleep(3) # delay to focus the game after launching the script + +while count < 100: + # Right click for context menu pyautogui.moveTo(RIGHTCLICK_X, RIGHTCLICK_Y) pyautogui.click(RIGHTCLICK_X, RIGHTCLICK_Y, button='right') - time.sleep(0.15) + time.sleep(TIMEOUTTIME) - # Click at pixel (2030, 875) + # Click on the "Save Object" option in the context menu pyautogui.click(SAVECONTEXTMENUCLICK_X, SAVECONTEXTMENUCLICK_Y) - time.sleep(0.15) + time.sleep(TIMEOUTTIME) - # Click at pixel (1700, 1110) + # Click on the name input field to focus it pyautogui.click(NAMEFIELDCLICK_X, NAMEFIELDCLICK_Y) - time.sleep(0.15) + time.sleep(TIMEOUTTIME) # Get the current Unix timestamp timestamp = str(int(time.time())) @@ -34,6 +47,10 @@ while True: # Enter the timestamp as key presses pyautogui.write(timestamp) - # Click at pixel (1770, 1200) + # Click on the save button pyautogui.click(SAVECLICK_X, SAVECLICK_Y) - time.sleep(0.2) + time.sleep(TIMEOUTTIME) + + # update the counter and display it + count += 1 + print(count, end='\r') diff --git a/tabletop_achievements/tabletop_tint_loop.py b/tabletop_achievements/tabletop_tint_loop.py index 9f378a8..fe24913 100644 --- a/tabletop_achievements/tabletop_tint_loop.py +++ b/tabletop_achievements/tabletop_tint_loop.py @@ -2,23 +2,40 @@ import pyautogui import time import random +# The position of the right-click to open the context menu on an object RIGHTCLICK_X = 1890 RIGHTCLICK_Y = 970 + +# The position of the "Color Tint" button in the context menu FIRSTCLICK_X = 2055 FIRSTCLICK_Y = 1225 + +# The position of the upper left corner of the color-selector square SECONDCLICK_XMIN = 600 -SECONDCLICK_XMAX = 1100 SECONDCLICK_YMIN = 600 + +# The position of the lower right corner of the color-selector square +SECONDCLICK_XMAX = 1100 SECONDCLICK_YMAX = 1100 + +# The position of the "Apply" button of the color selector CONFIRMCLICK_X = 760 CONFIRMCLICK_Y = 1550 + +# The timeout for UI elements to load (in seconds) SLEEPTIME = 0.15 -time.sleep(3) -#pyautogui.click(RIGHTCLICK_X, RIGHTCLICK_Y, button='right') +# initialize the counter +count = 0 -while True: - # Click at pixel (2055, 1225) +time.sleep(3) # delay to focus the game after launching the script + +# Move to and rightclick on the object +pyautogui.moveTo(RIGHTCLICK_X, RIGHTCLICK_Y) +pyautogui.click(RIGHTCLICK_X, RIGHTCLICK_Y, button='right') + +while count < 1000: + # Click on the "Color Tint" option pyautogui.click(FIRSTCLICK_X, FIRSTCLICK_Y) time.sleep(SLEEPTIME) @@ -30,6 +47,6 @@ while True: pyautogui.click(x, y) time.sleep(SLEEPTIME) - # Click at pixel (760, 1550) + # Click on the "Apply" button pyautogui.click(CONFIRMCLICK_X, CONFIRMCLICK_Y) time.sleep(SLEEPTIME)