Sentdex / pygta5

Explorations of Using Python to play Grand Theft Auto 5.
MIT License
3.91k stars 823 forks source link

Games that requires focus for the keyinputs to actually register #103

Closed usamahjundia closed 2 years ago

usamahjundia commented 6 years ago

I kinda altered the dataset creation script, mostly because the game registers a different set of keys and due to how only some region are worth taking data of, and testing it on a game called Touhou yields this result: The image grab works fine. The key detection works fine IF and only IF the command line (i ran the script in command line) is focused The game will not register my inputs if it is not focused

EDIT : I have tried this with another games and it turns out, having the cli not focused on some other games still detects the pressed keys when i'm focused on the game windows.. but this happen specifically on the game i'm currently using..

My bet is that the particular game i am working with has a different way of accepting inputs.. is there any workaround for this? Thanks!

PeterGardas commented 6 years ago

I don't know what you mean. What libs are you using, i found out that some of them really need to get terminal focus while some don't, check this code out it should work. https://github.com/Sentdex/pygta5/issues/101

Petr Gardas