Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Sam authored and Matt Sam committed Jul 25, 2021
1 parent 053802a commit 900fbeb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
12 changes: 8 additions & 4 deletions AI_M_BOT(opencv+yolo)/AI_M_BOT_X1.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def control_mouse(a, b, fps_var, ranges, rate, go_fire, win_class, move_rx, move
if enhanced_holdback[1]:
win32gui.SystemParametersInfo(SPI_SETMOUSE, [0, 0, 0], 0)

if fps_var:
if fps_var and guide_to_target[0]:
if move_range > 5 * ranges:
b = uniform(0.7 * b, 1.3 * b)
a /= DPI_Var
Expand Down Expand Up @@ -427,6 +427,10 @@ def check_status(exit0, mouse):
if GetAsyncKeyState(0x33) or GetAsyncKeyState(0x34): # 3,4
mouse = 0
arr[15] = 0
if GetAsyncKeyState(0x46): # F
guide_to_target[0] = True
if GetAsyncKeyState(0x4A): # J
guide_to_target[0] = False
if GetAsyncKeyState(VK_MENU) and platform != 'win32': # Alt
win_cap.update_window_info()
if GetAsyncKeyState(0x50): # P
Expand Down Expand Up @@ -540,8 +544,7 @@ def detection2(que, array):
print('呵呵...请重新选择')

# 初始化变量以及提升进程优先级
run_platform = platform
if run_platform == 'win32':
if platform == 'win32':
pid = GetCurrentProcessId()
handle = OpenProcess(PROCESS_ALL_ACCESS, True, pid)
SetPriorityClass(handle, ABOVE_NORMAL_PRIORITY_CLASS)
Expand All @@ -555,6 +558,7 @@ def detection2(que, array):
test_win = [False]
move_record_x = []
move_record_y = []
guide_to_target = [True]

# 如果文件不存在则退出
check_file('yolov4-tiny')
Expand Down Expand Up @@ -635,7 +639,7 @@ def detection2(que, array):

while True:
# 选择截图方式
screenshot = (win_cap.get_screenshot() if run_platform == 'win32' else win_cap.grab_screenshot())
screenshot = (win_cap.get_screenshot() if platform == 'win32' else win_cap.grab_screenshot())

try:
screenshot.any()
Expand Down
12 changes: 8 additions & 4 deletions AI_M_BOT(opencv+yolo)/AI_M_BOT_X2.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def control_mouse(a, b, fps_var, ranges, rate, go_fire, win_class, move_rx, move
if enhanced_holdback[1]:
win32gui.SystemParametersInfo(SPI_SETMOUSE, [0, 0, 0], 0)

if fps_var:
if fps_var and guide_to_target[0]:
if move_range > 5 * ranges:
b = uniform(0.7 * b, 1.3 * b)
a /= DPI_Var
Expand Down Expand Up @@ -450,6 +450,10 @@ def check_status(exit0, mouse):
if GetAsyncKeyState(0x33) or GetAsyncKeyState(0x34): # 3,4
mouse = 0
arr[15] = 0
if GetAsyncKeyState(0x46): # F
guide_to_target[0] = True
if GetAsyncKeyState(0x4A): # J
guide_to_target[0] = False
if GetAsyncKeyState(VK_MENU) and platform != 'win32': # Alt
win_cap.update_window_info()
if GetAsyncKeyState(0x50): # P
Expand Down Expand Up @@ -563,8 +567,7 @@ def detection2(que, array):
print('呵呵...请重新选择')

# 初始化变量以及提升进程优先级
run_platform = platform
if run_platform == 'win32':
if platform == 'win32':
pid = GetCurrentProcessId()
handle = OpenProcess(PROCESS_ALL_ACCESS, True, pid)
SetPriorityClass(handle, ABOVE_NORMAL_PRIORITY_CLASS)
Expand All @@ -578,6 +581,7 @@ def detection2(que, array):
test_win = [False]
move_record_x = []
move_record_y = []
guide_to_target = [True]

# 如果文件不存在则退出
check_file('yolov4-tiny')
Expand Down Expand Up @@ -658,7 +662,7 @@ def detection2(que, array):

while True:
# 选择截图方式
screenshot = (win_cap.get_screenshot() if run_platform == 'win32' else win_cap.grab_screenshot())
screenshot = (win_cap.get_screenshot() if platform == 'win32' else win_cap.grab_screenshot())

try:
screenshot.any()
Expand Down

0 comments on commit 900fbeb

Please sign in to comment.