-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdm3.py
79 lines (64 loc) · 1.97 KB
/
dm3.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
from playsound import playsound
import pyautogui as pag
import time
from threading import Thread
title_offset = (1440, 423)
pot_offset = (1357, 740)
met_offset = (1509, 737)
pwr_offset = (1659, 707)
gray = (128, 128, 128)
thread_running = True
def alrm():
playsound("alarm.wav")
def potf(title):
pot = [0, 0]
pot[0] = title[0]-title_offset[0]+pot_offset[0]
pot[1] = title[1]-title_offset[1]+pot_offset[1]
while thread_running:
if pag.pixel(pot[0], pot[1]) == gray:
t = Thread(target = alrm)
t.start()
time.sleep(15)
time.sleep(0.5)
def metf(title):
met = [0, 0]
met[0] = title[0]-title_offset[0]+met_offset[0]
met[1] = title[1]-title_offset[1]+met_offset[1]
while thread_running:
if pag.pixel(met[0], met[1]) == gray:
t = Thread(target = alrm)
t.start()
time.sleep(15)
time.sleep(0.5)
def pwrf(title):
pwr = [0, 0]
pwr[0] = title[0]-title_offset[0]+pwr_offset[0]
pwr[1] = title[1]-title_offset[1]+pwr_offset[1]
while thread_running:
if pag.pixel(pwr[0], pwr[1]) == gray:
t = Thread(target = alrm)
t.start()
time.sleep(15)
time.sleep(0.5)
def exitf():
a = input("press enter again to exit")
if __name__=='__main__':
thread_running = True
title = pag.locateCenterOnScreen("title.png")
if title is None:
print("Looking for title...")
while title is None:
time.sleep(0.5)
title = pag.locateCenterOnScreen("title.png")
_ = input("Title found, press enter to run")
t0 = Thread(target = exitf)
#t1 = Thread(target = potf, args=(title,))
t2 = Thread(target = metf, args=(title,))
t3 = Thread(target = pwrf, args=(title,))
t0.start()
#t1.start()
t2.start()
t3.start()
t0.join()
thread_running = False
print("exit")