fixed loop for double dig

added additional sort for equip
This commit is contained in:
2022-05-20 22:42:11 +02:00
parent 6f7e40b5da
commit 5b4dfc0a05
2 changed files with 20 additions and 1 deletions

View File

@@ -38,8 +38,11 @@ def run():
while runcounter != 0: while runcounter != 0:
if double_dig and runcounter == 1: if double_dig and runcounter == 1:
dig_point(290, 100, 200) dig_point(290, 100, 200)
level = 1
plot_size = 45
cv.waitKey(2000) cv.waitKey(2000)
runcounter = runcounter - 1 runcounter = runcounter - 1
while True: while True:
if keyboard.is_pressed('p') == True: if keyboard.is_pressed('p') == True:
pause = True pause = True

View File

@@ -1,4 +1,5 @@
import random import random
from operator import itemgetter
from time import time from time import time
from window_capture import WindowCapture from window_capture import WindowCapture
from vision import Vision from vision import Vision
@@ -20,7 +21,7 @@ HSV_DEFAULT = HsvFilter(0, 0, 0, 179, 255, 255, 0, 0, 0, 0)
def run(): def run():
EMITTER_TO_USE = EMITTER_RING EMITTER_TO_USE = EMITTER_WAND
SPAWN_COUNT = 15 SPAWN_COUNT = 15
# initialize the user-class # initialize the user-class
config = UserConfigs() config = UserConfigs()
@@ -45,6 +46,11 @@ def run():
tresholds = [] tresholds = []
masks = [] masks = []
fixed_merge_pos_1 = []
fixed_merge_pos_2 = []
fixed_merge_pos_3 = []
fixed_merge_pos_4 = []
if EMITTER_TO_USE == EMITTER_MUSH: if EMITTER_TO_USE == EMITTER_MUSH:
include_books(needles, hsvs, tresholds, masks) include_books(needles, hsvs, tresholds, masks)
include_mushs(needles, hsvs, tresholds, masks) include_mushs(needles, hsvs, tresholds, masks)
@@ -119,6 +125,12 @@ def run():
points = vision_stun.get_click_points(spawn_0) points = vision_stun.get_click_points(spawn_0)
for point in points: for point in points:
click_point(config, points[0][0], points[0][1]) click_point(config, points[0][0], points[0][1])
fixed_merge_pos_1 = [point[0] + 70, point[1]]
fixed_merge_pos_2 = [point[0] + 140, point[1]]
fixed_merge_pos_3 = [point[0] + 70, point[1] + 70]
fixed_merge_pos_4 = [point[0] + 140, point[1] + 70]
if keyboard.is_pressed('p') == True or pause == True: if keyboard.is_pressed('p') == True or pause == True:
pause = True pause = True
break break
@@ -144,7 +156,11 @@ def run():
pause = True pause = True
break break
#sort rectangles by top
rectangles = sorted(rectangles, key=itemgetter(1))
points = vision_stun.get_click_points(rectangles) points = vision_stun.get_click_points(rectangles)
move_breaker = check_and_move_tile(capture_window, vision_stun, config, move_breaker = check_and_move_tile(capture_window, vision_stun, config,
[70, 70, rectangles[0][0] + 70, rectangles[0][1]], needles[rer], [70, 70, rectangles[0][0] + 70, rectangles[0][1]], needles[rer],
hsvs[rer], tresholds[rer], masks[rer], hsvs[rer], tresholds[rer], masks[rer],