diff options
-rw-r--r-- | bot.py | 29 |
1 files changed, 14 insertions, 15 deletions
@@ -1,33 +1,32 @@ | |||
1 | # from pyautogui import * | 1 | import pyautogui as pg |
2 | import pyautogui | ||
3 | from time import sleep | 2 | from time import sleep |
4 | 3 | ||
5 | 4 | ||
6 | def move(_pos, _now): | 5 | def move(_pos, _now): |
7 | if _pos == 'left' and _now == 'left': | 6 | if _pos == 'left' and _now == 'left': |
8 | pyautogui.typewrite(['left']) | 7 | pg.typewrite(['left']) |
9 | pyautogui.typewrite(['left']) | 8 | pg.typewrite(['left']) |
10 | elif _pos == 'left' and _now == 'right': | 9 | elif _pos == 'left' and _now == 'right': |
11 | pyautogui.typewrite(['right']) | 10 | pg.typewrite(['right']) |
12 | pyautogui.typewrite(['right']) | 11 | pg.typewrite(['right']) |
13 | elif _pos == 'right' and _now == 'right': | 12 | elif _pos == 'right' and _now == 'right': |
14 | pyautogui.typewrite(['right']) | 13 | pg.typewrite(['right']) |
15 | pyautogui.typewrite(['right']) | 14 | pg.typewrite(['right']) |
16 | elif _pos == 'right' and _now == 'left': | 15 | elif _pos == 'right' and _now == 'left': |
17 | pyautogui.typewrite(['left']) | 16 | pg.typewrite(['left']) |
18 | pyautogui.typewrite(['left']) | 17 | pg.typewrite(['left']) |
19 | 18 | ||
20 | width, height = pyautogui.size() | 19 | width, height = pg.size() |
21 | width *= 0.5 | 20 | width *= 0.5 |
22 | pyautogui.moveTo(333, 600) | 21 | pg.moveTo(333, 600) |
23 | pyautogui.click() | 22 | pg.click() |
24 | 23 | ||
25 | posY = [360, 260, 160] | 24 | posY = [360, 260, 160] |
26 | posX = [276, 398] | 25 | posX = [276, 398] |
27 | 26 | ||
28 | q = ['left', 'left', 'left'] | 27 | q = ['left', 'left', 'left'] |
29 | 28 | ||
30 | im = pyautogui.screenshot(region=(0, 0, width, height)) | 29 | im = pg.screenshot(region=(0, 0, width, height)) |
31 | l0 = im.getpixel((posX[0], posY[0])) | 30 | l0 = im.getpixel((posX[0], posY[0])) |
32 | l1 = im.getpixel((posX[0], posY[1])) | 31 | l1 = im.getpixel((posX[0], posY[1])) |
33 | l2 = im.getpixel((posX[0], posY[2])) | 32 | l2 = im.getpixel((posX[0], posY[2])) |
@@ -58,7 +57,7 @@ while True: | |||
58 | move(pos, now) | 57 | move(pos, now) |
59 | qlen = 0 | 58 | qlen = 0 |
60 | elif qlen == 0: | 59 | elif qlen == 0: |
61 | im = pyautogui.screenshot(region=(0, 0, width, height)) | 60 | im = pg.screenshot(region=(0, 0, width, height)) |
62 | l0 = im.getpixel((posX[0], posY[0])) | 61 | l0 = im.getpixel((posX[0], posY[0])) |
63 | l1 = im.getpixel((posX[0], posY[1])) | 62 | l1 = im.getpixel((posX[0], posY[1])) |
64 | l2 = im.getpixel((posX[0], posY[2])) | 63 | l2 = im.getpixel((posX[0], posY[2])) |