first commit
This commit is contained in:
49
main.py
Normal file
49
main.py
Normal file
@@ -0,0 +1,49 @@
|
||||
import pyautogui
|
||||
import time
|
||||
|
||||
# ==========================
|
||||
# CONFIG
|
||||
# ==========================
|
||||
|
||||
P1 = (34, 1236)
|
||||
COLOR_P1 = (191, 156, 233)
|
||||
|
||||
P2 = (25, 1281)
|
||||
COLOR_P2 = (166, 227, 161)
|
||||
|
||||
|
||||
INTERVALO = 3
|
||||
TOLERANCIA = 0
|
||||
|
||||
# ==========================
|
||||
# FUNCIONES
|
||||
# ==========================
|
||||
|
||||
def coincide(a, b, tol=0):
|
||||
return all(abs(x - y) <= tol for x, y in zip(a, b))
|
||||
|
||||
|
||||
print("Detector iniciado... Ctrl+C para salir.")
|
||||
|
||||
while True:
|
||||
c1 = pyautogui.pixel(*P1)
|
||||
c2 = pyautogui.pixel(*P2)
|
||||
|
||||
print(f"P1: {c1} | P2: {c2}")
|
||||
|
||||
if coincide(c1, COLOR_P1, TOLERANCIA) and coincide(c2, COLOR_P2, TOLERANCIA):
|
||||
print("Colores correctos → Click en P1 + Enter")
|
||||
|
||||
# Mover a P1
|
||||
pyautogui.moveTo(*P1, duration=0.2)
|
||||
|
||||
# Click
|
||||
pyautogui.click()
|
||||
|
||||
# Enter
|
||||
pyautogui.press("enter")
|
||||
|
||||
# Cooldown
|
||||
time.sleep(5)
|
||||
|
||||
time.sleep(INTERVALO)
|
||||
Reference in New Issue
Block a user