jfd02 / TFT-OCR-BOT

A bot that plays Teamfight Tactics using OCR. Keeps track of bench, board, items, and plays the user defined team comp.
GNU General Public License v3.0
325 stars 91 forks source link

Bot stops playing after round 1-4 #244

Closed MohamadHajjRabee closed 1 year ago

MohamadHajjRabee commented 1 year ago

the bot runs perfect until round 1-4 he buys from the shop and after that it does nothing

here is the full code on terminal:

$ python main.py
TFT OCR | https://github.com/jfd02/TFT-OCR-BOT
Close this window to terminate the overlay window & program

[Auto Queue]
  Client found
  Creating lobby
  Changed arena skin to default
  Creating lobby
  Starting queue
  Starting queue
  Starting queue

[!] Searching for game window
  Did not find window, trying again...
  Did not find window, trying again...
  Did not find window, trying again...
  Did not find window, trying again...
  Window League of Legends (TM) Client found
    Location: (0, 0)
    Size:     (1366, 768)

[Carousel Round] 1-1
  Health: 100
  Getting a champ from the carousel

[Second Round] 1-2
  Moving ? to board
  Health: 100

[PvE Round] 1-3
  Shop: [(3, 'Kayle'), (1, 'Illaoi'), (0, 'Orianna'), (4, 'Jhin'), (2, 'Milio')]
    Purchased Kayle
  Moving Kayle to board
  Moving Milio to board
  Health: 100

[PvE Round] 1-4
  Shop: [(1, 'Jhin'), (0, 'Jhin'), (2, 'Illaoi'), (3, 'Samira'), (4, 'Kayle')]
    Purchased Kayle
  Moving ? to board
  Health: 100

As you can see my screen size is 1366x768.

anthony5301 commented 1 year ago

Can you change the display size of your computer to 1920x1080 and try again?

MohamadHajjRabee commented 1 year ago

sadly i tried to do it but i couldn't cuz thats the maximum resolution my laptop display support

anthony5301 commented 1 year ago

Try replacing line 35 in screen_coords.py with this: ROUND_POS: Vec4 = Vec4(GameWindow(760, 4, 870, 34))

In addition, if you can take screenshots of the screens for stages 1-x and 2-x and upload them here (remember to blur out the player names), it would be a great help to me.

anthony5301 commented 1 year ago

Delete those screenshot because you didnt blur your game name!!!

MohamadHajjRabee commented 1 year ago

Oopsie I deleted the whole comment Did you get the screenshots or do u want me to send them again ?

MohamadHajjRabee commented 1 year ago

anyways i updated the screenshots Screenshot_2023-10-15_132819 Screenshot_2023-10-15_132925 Screenshot_2023-10-15_132858

anthony5301 commented 1 year ago

I got it, could you run the bot with original screen_coords.py and see if the bot can recognize stage 3-x and later stages? It seems the screen capture function crop the boder of the number and makes ocr malfunction. Give me some times to edit the screen coords.

MohamadHajjRabee commented 1 year ago

i will try again later and let you know is it ok if i play during 2-x ? or should i stay afk all time ?

anthony5301 commented 1 year ago

Yes you can, just check the bot window show the stages number or not It's like pvp round 3-1 pve round 4-6

anthony5301 commented 1 year ago

try this:

ROUND_POS: Vec4 = Vec4(GameWindow(767, 10, 870, 34))

ROUND_POS_ONE: Vec4 = Vec4(GameWindow(2, 0, 42, 24), use_screen_offset=False)

ROUND_POS_TWO: Vec4 = Vec4(GameWindow(57, 0, 96, 24), use_screen_offset=False)
MohamadHajjRabee commented 1 year ago

Hi i can confirm that the bot is now working good on all rounds 1-x 2-x 3-x 4-x and even 5-x with those new cords you provided i played a full match and it was working all time thank you for your help