docs and small tweaks

This commit is contained in:
J-onasJones 2024-10-09 02:14:38 +02:00
parent 4dbe771bdc
commit 14ca4a504f
3 changed files with 69 additions and 21 deletions

View file

@ -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')