Hello everyone, botcity started showing a strange problem after compiling with auto-py-to-exe. I always used the same machine and always compiled it that way. However, since yesterday, when I use the self.find_all function and create a list, when running Pycharm it finds the items in the stipulated order, but after compiling in .exe the order of the objects simply changes. I’ve been using it for 2 years and have never had any problems. Code follows:
while self.find(label="arena_150", matching=0.7, waiting_time=3000, grayscale=True):
print('LH energy found')
elements = self.find_all(label="arena_150", matching=0.7, waiting_time=3000, grayscale=True)
elements_list = list(elements)
number_of_elements = len(elements_list)
#if number_of_elements > 5:
# number_of_elements = 5
print('Energy available: ' + str(number_of_elements))
for _ in range(int(number_of_elements)):
#x = elements_list[number_of_elements - plays].left
#y = elements_list[number_of_elements - plays].top
x = elements_list[-1].left
y = elements_list[-1].top
a = elements_list[-2].left
b = elements_list[-2].top
self.mouse_move(x, y)
pyautogui.click()
print('Battle X')
plays +=1
print(number_of_elements - plays)
time.sleep(3)
self.mouse_move(a, b)
pyautogui.click()
print('Battle X')
time.sleep(3)
Objects [-1] and [-2] are correctly identified in pycharm, but after compiling in .exe the order changes completely.
I know that computer vision looks for objects from left to right and top to bottom, but this apparently changes after compiling
expected order of objects:
[Box(left=1413, top=654, width=66, height=38)
Box(left=981, top=753, width=66, height=38)
Box(left=1154, top=753, width=66, height=38)
Box(left=1326, top=753, width=66, height=38)
Box(left=1499, top=753, width=66, height=38)]
after compiled:
[Box(left=1154, top=753, width=66, height=38)
Box(left=1499, top=753, width=66, height=38)
Box(left=981, top=753, width=66, height=38)
Box(left=1413, top=654, width=66, height=38)
Box(left=1326, top=753, width=66, height=38)]