-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathReactionTime.py
More file actions
43 lines (35 loc) · 1.33 KB
/
ReactionTime.py
File metadata and controls
43 lines (35 loc) · 1.33 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/python
# -*- coding: utf-8 -*-
import pyautogui
import time
import webbrowser
webbrowser.open('https://www.humanbenchmark.com/tests/reactiontime',
new=2)
time.sleep(3) # time it takes for webbrowser to open, change this to match your pc
delay = 0 # change this for delay in seconds
lvls = 5 # change this for the amount of levels you want the bot to complete
(width, height) = pyautogui.size()
print (width, height)
width = int(width / 2)
height = int(height / 4)
pyautogui.moveTo(width, height)
# gets the current hex color of the game
color = pyautogui.pixel(width, height)
hexColor = '%02x%02x%02x' % color
print hexColor
if hexColor == '0089ce':
pyautogui.click()
for x in range(lvls):
# checks every time if the color is not green, when it is green it delays and then clicks the screen and waits for the next round
while hexColor != '18d971':
color = pyautogui.pixel(width, height)
hexColor = '%02x%02x%02x' % color
print hexColor
time.sleep(delay)
pyautogui.click()
if x != 4:
pyautogui.click()
hexColor = ''
else:
pyautogui.alert(text='Please have the tab fullscreened on your primary monitor, values may not work for resolutions other than 1920 by 1080'
, title='Game not detected!', button='Ok')