commit 2885768c45984cfbae2556f46921505d4060c7eb Author: Dasemu Date: Thu Feb 26 03:40:19 2026 +0100 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..505a3b1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +# Python-generated files +__pycache__/ +*.py[oc] +build/ +dist/ +wheels/ +*.egg-info + +# Virtual environments +.venv diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/detector.py b/detector.py new file mode 100644 index 0000000..645f003 --- /dev/null +++ b/detector.py @@ -0,0 +1,25 @@ +import pyautogui +import keyboard +import time + +print("Listo. Pulsa 'P' para imprimir posición y color. Ctrl+C para salir.") + +def obtener_pixel_mouse(): + # Posición actual del ratón + x, y = pyautogui.position() + + # Captura solo 1x1 px (eficiente) + img = pyautogui.screenshot(region=(x, y, 1, 1)) + color = img.getpixel((0, 0)) + + print(f"Posición: ({x}, {y}) | Color RGB: {color}") + + +while True: + if keyboard.is_pressed("p"): + obtener_pixel_mouse() + + # Anti-rebote para no spamear mientras mantienes la tecla + time.sleep(0.3) + + time.sleep(0.05) diff --git a/main.py b/main.py new file mode 100644 index 0000000..1493865 --- /dev/null +++ b/main.py @@ -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)