From c5000abe9d81b13248e1b969f0b907b934cd9737 Mon Sep 17 00:00:00 2001 From: def <8384198-dettlaff@users.noreply.gitlab.com> Date: Wed, 1 Dec 2021 20:36:48 +0000 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BD=D0=BE=D0=B2=D1=8B=D0=B9=20=D1=84=D0=B0?= =?UTF-8?q?=D0=B9=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autogames/pic.py | 75 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 autogames/pic.py diff --git a/autogames/pic.py b/autogames/pic.py new file mode 100644 index 0000000..721b37f --- /dev/null +++ b/autogames/pic.py @@ -0,0 +1,75 @@ +from PIL import ImageGrab +import time +import os +# mouse = Controller() +from pynput.keyboard import Key, Controller +keyboard = Controller() + +# x = [610, 620, 630, 640, 650, 660, 670, 680, 690, +# 700, 710, 720, 730, 740, 750, 760, 770, 780, 790, +# 800, 810, 820, 830, 840, 850, 860, 870, 880, 890] + # полоса по Х + +x = [10, 20, 30, 40, 50, 60, 70, 80, 90, + 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, + 200, 210, 220, 230, 240, 250, 260, 270, 280, 290] + # полоса по Х + +def go(y): + + global stop + print("Go with y =", y) + for i in range(len(x)): + + try: + color = image.getpixel((x[i], y)) + except: + pass + + if color != (83, 83, 83) and i > 15: + + print("\033[31mALERT", i, "\033[0m") + keyboard.press(Key.right) + time.sleep(0.1) + keyboard.release(Key.right) + print("\033[31mGo right!\033[0m") + + + stop = False + return stop + + elif color != (83, 83, 83) and i < 15: + + print("\033[31mDETECTED at", i, "\033[0m") + keyboard.press(Key.left) + time.sleep(0.1) + keyboard.release(Key.left) + print("\033[31mGo left!\033[0m") + + stop = False + return stop + + +for i1 in range(99999999): + + stop = True + + image = ImageGrab.grab((597, 240, 895, 505)) + print("screenshot №" + str(i1)) + + + go(y=60) + + if stop: + go(y=40) + + if stop: + go(y=30) + + if stop: + go(y=20) + + if stop: + go(y=15) + + #os.system("clear")