-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
27 lines (25 loc) · 809 Bytes
/
bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import pytesseract
import time
from PIL import Image
from pymouse import PyMouse
import quickgrab
m = PyMouse()
while True:
try:
quickgrab.screengrab()
operation = pytesseract.image_to_string(Image.open("./screen.png"))
operation = operation.replace(":", "=").replace(" ", "").replace("(", "1").replace("S", "5").replace("B", "8").replace("O", "0")
print(operation)
operation = operation.split("=")
left = operation[0]
right = operation[1]
left = (eval(left.replace("x", "*").replace("X", "*").replace("l", "/")))
right = eval(right)
if left == right:
m.click(873, 934)
else:
m.click(1039, 934)
time.sleep(0.4)
except NameError:
m.click(873, 934)
time.sleep(0.4)