-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.py
More file actions
54 lines (41 loc) · 1.32 KB
/
debug.py
File metadata and controls
54 lines (41 loc) · 1.32 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
44
45
46
47
48
49
50
51
52
53
54
import cv2
import time
import amonguscv2 as aucv
import amongusinput as auin
import amongustask as autask
import amongusmap as aumap
import math
import win32api
import pyautogui
import threading
import numpy as np
def debug():
last_time = time.time()
state_left = win32api.GetKeyState(0x01) # Left button down = 0 or 1. Button up = -127 or -128
while(True):
#print(f'Frame took {time.time()-last_time} seconds')
#last_time = time.time()
screen = aucv.grabScreen()
mouse = win32api.GetKeyState(0x01)
if mouse <= -127:
try:
pos = pyautogui.position()
print(pyautogui.position())
print(screen[pos[1],pos[0]])
except:
pass
player = aucv.findImage(screen,"ref/player-template.png",.87)
tasks = aucv.findImage(screen,"ref/task-template.png",.9)
if (len(player)>=1):
closeTask = aumap.findClosestTask(player,tasks)
if(len(closeTask) > 0):
print(tasks)
print("Player",player)
print(closeTask)
auin.goto(player,closeTask)
input()
cv2.imshow('window', screen)
if cv2.waitKey(25) & 0xFF == ord('q'):
cv2.destroyAllWindows()
break
debug()