Skip to content

Commit

Permalink
fixed index out of bounds error with displaying config.path in Captur…
Browse files Browse the repository at this point in the history
…e.py
  • Loading branch information
tanjeffreyz committed Jun 6, 2021
1 parent 283606d commit 3e5a95f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 24 deletions.
2 changes: 2 additions & 0 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def _main():
print('\nInitialized detection algorithm.')

with mss.mss() as sct:
config.ready = True
config.listening = True
buff = config.command_book['buff']()
while True:
Expand Down Expand Up @@ -153,6 +154,7 @@ def _solve_rune(model, sct):
move(*config.rune_pos).execute()
adjust = config.command_book.get('adjust')
adjust(*config.rune_pos).execute()
time.sleep(0.2)
press('y', 1, down_time=0.2) # Press 'y' to interact with rune in-game
print('\nSolving rune:')
inferences = []
Expand Down
11 changes: 6 additions & 5 deletions capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _main():
if not config.calibrated:
frame = np.array(sct.grab(config.MONITOR))

# Get the bottom right point of the minimap
# Get the bottom right corner of the minimap
_, br = utils.single_match(frame[:round(frame.shape[0] / 4),
:round(frame.shape[1] / 3)],
config.MINIMAP_TEMPLATE)
Expand Down Expand Up @@ -102,10 +102,11 @@ def _main():
-1)

# Draw the current path that the program is taking
if config.enabled and len(config.path) > 1:
for i in range(len(config.path) - 1):
start = utils.convert_to_absolute(config.path[i], minimap)
end = utils.convert_to_absolute(config.path[i + 1], minimap)
path = config.path
if config.enabled and len(path) > 1:
for i in range(len(path) - 1):
start = utils.convert_to_absolute(path[i], minimap)
end = utils.convert_to_absolute(path[i + 1], minimap)
cv2.line(minimap, start, end, (255, 255, 0), 1)

# Draw each Point in the routine as a circle
Expand Down
7 changes: 7 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,19 @@
while not config.ready:
time.sleep(0.01)

config.ready = False

listener = Listener()
listener.start()

bot = Bot()
bot.start()

while not config.ready:
time.sleep(0.01)

print('\nSuccessfully initialized Auto Maple, now accepting commands.')

# Periodically save changes to the active Layout if it exists
while True:
if config.layout:
Expand Down
19 changes: 0 additions & 19 deletions routines/test.csv

This file was deleted.

0 comments on commit 3e5a95f

Please sign in to comment.