Browse Source

error bugfix

Neccor 4 years ago
parent
commit
7026b8516e
2 changed files with 5 additions and 12 deletions
  1. 1
    1
      .gitignore
  2. 4
    11
      main.py

+ 1
- 1
.gitignore View File

@@ -2,7 +2,7 @@
2 2
 # Custom
3 3
 screenshots/
4 4
 screenshot.png
5
-error/*
5
+error/*.*
6 6
 
7 7
 # Byte-compiled / optimized / DLL files
8 8
 __pycache__/

+ 4
- 11
main.py View File

@@ -2,25 +2,17 @@ import cv2
2 2
 import time
3 3
 import pyautogui
4 4
 from datetime import datetime, date
5
-from os.path import isfile, join
6
-import os
7 5
 
8 6
 eol = int(0)
9 7
 
10
-if not os.path.exists(os.path.join(os.getcwd(), "error")):
11
-	os.path.join(os.getcwd(), "error")
12
-
13 8
 def find(image, coef=None):
14 9
 	template = cv2.imread("assets/{}".format(image), 0)
15 10
 	width, height = template.shape[::-1]
16 11
 	screen = cv2.imread("screenshot.png", 0)
17 12
 	width2, height2 = screen.shape[::-1]
18
-	# print(f"Breite: {width} | Höhe: {height}\nBreite: {width2} | Höhe: {height2}")
19 13
 	match = cv2.matchTemplate(screen, template, cv2.TM_CCOEFF_NORMED)
20 14
 	value, location = cv2.minMaxLoc(match)[1], cv2.minMaxLoc(match)[3]
21
-	print(f"{image} | {value}")
22 15
 	if (value >= 0.85):
23
-		print(f"{image} | {value}")
24 16
 		return (location[0], location[1], width, height, value)
25 17
 	else:
26 18
 		return None
@@ -28,7 +20,6 @@ def find(image, coef=None):
28 20
 def autoduelloop(eol):
29 21
 	while True:
30 22
 		time.sleep(1)
31
-		print(f"\n")
32 23
 		pyautogui.screenshot("screenshot.png")
33 24
 
34 25
 		# OK Button
@@ -111,7 +102,7 @@ def autoduelloop(eol):
111 102
 
112 103
 		# End of the Loop
113 104
 		print(f"End of the Loop | EOL: {eol}")
114
-		time.sleep(0)
105
+		time.sleep(3)
115 106
 		if eol >= 5:
116 107
 			# Arrow
117 108
 			arrow = find("arrow.png")
@@ -123,7 +114,9 @@ def autoduelloop(eol):
123 114
 while True:
124 115
 	autoduelloop(eol)
125 116
 	eol += 1
126
-	if eol >= 10:
117
+	if eol == 10:
118
+		pyautogui.click((950, 280))
119
+	elif eol >= 15:
127 120
 		time.sleep(1)
128 121
 		eol = int(0)
129 122
 		pyautogui.screenshot(f"error/error-{datetime.now().strftime('%Y-%m-%d-%H-%M')}.png")

Loading…
Cancel
Save