def aboba():
pyautogui.press('enter'), pyautogui.typewrite('/homefast'), pyautogui.press('enter')
print("хом")
time.sleep(1)
time.sleep(1)
while True:
if __name__ == "__main__":
im = ImageGrab.grab(bbox=(190, 1011, 215, 1023)) # X1,Y1,X2,Y2
im.save('screen.png')
img = cv2.imread('screen.png')
img = cv2.resize(img, None, fx=9, fy=9)
HP = pytesseract.image_to_string(img, config='outputbase digits')
print(HP)
if HP > str(0) and HP < str(range(1, 36)):
aboba()1009
хом
1009
хом
hpInt = int(HP[:-1]) # [:-1] чтобы убрать последний символ, который 9, который кривой процент.
if 0 < hpInt and hpInt < 35:
aboba()