Sizzzles / TFT-OCR-BOT

TFT OCR Bot with auto comps loading from lolchess
GNU General Public License v3.0
18 stars 2 forks source link

Remove names of champs in game and humanize mouse movements? #29

Closed drizzyman closed 9 months ago

drizzyman commented 9 months ago

Remove names of champs in game and humanize mouse movements?

Sizzzles commented 9 months ago

Edit mk_function.py to something like.....

from time import sleep
import random
import pydirectinput

def right_click(coords: tuple, duration=0.5) -> None:
    """Simulate a right click at the specified coordinates.

    Args:
        coords (tuple): A tuple containing cartesian coordinates (x, y).
        duration (float): The duration of the mouse movement.
    """
    offset: int = random.randint(-3, 3)
    pydirectinput.moveTo(coords[0] - offset, coords[1] - offset, duration=duration)

    # Delay
    sleep(random.uniform(0.1, 0.3))

    pydirectinput.mouseDown(button="right")
    pydirectinput.mouseUp(button="right")

(Adjust the duration and delay values based on your preferences/needs. This is only a example haven't tested so no idea if this example will work for your use case)

Edit every method that uses pydirectinput.moveTo like the example shown. This will increase the movement time of the bot and may cause unexpected behavior therefore this won't be implemented.