50 lines
900 B
Python
50 lines
900 B
Python
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)
|