I am trying to automate GTA V online mining job using artificial intelligence to read pixels from the screen, and then press a button. For those who don't play videogames, mining minerals in the game requires you to correctly press buttons (1-9 in the numeric row, key pad doesn't work) when they pop up on the screen... Pretty simple... But nothing seems to work... I have tried pressing a button with Pyautogui
pyautogui.press(str(detected_number))
Pynput:
kb = Controller()
kb.press(str(detected_number))
kb.release(str(detected_number))
And even windows keyboard events with ctypes (too much code for this post) but nothing seems to work. Numbers appear and work on every other application, I can freely type text in notepad using code above, but the game still somehow tells the difference physical key press, and automated one. How ?