Using spy++ I found that when you press the 'F' key for example, 3 messages are send:
First a WM_KEYDOWN with nVirtKey='F', cRepeat=1 and ScanCode=21
Then a WM_CHAR with chCharCode='102', cRepeat=1 and ScanCode=21
Finally a WM_KEYIP with nVirtKey='F', cRepeat=1 and ScanCode=21
While the nVirtKey (or/and the chCharcode, I don't really know tbh) does affect the game's console, it is the ScanCode that affects the game.
For example, a ScanCode of 21 corresponds to fishing, 10 is using potion. You can find out which ScanCode corresponds to an action by watching messages with spy++ while doing it.
In order to replay the message with the right ScanCode, I found out that you can use (in Python):
Code:
win32api.PostMessage(hwnd,win32con.WM_KEYDOWN, x, y)
time.sleep(0.1)
win32api.PostMessage(hwnd,win32con.WM_KEYUP, x, y)
Where :
- hwnd is the window corresponding to Trove, you can use win32gui.FindWindow(None, "Trove") to get it.
- x corresponds to nVirtKey (you can leave it to 0)
- y contains the ScanCode, if y=0x210000 the ScanCode will be 21, y=0x100000 the ScanCode will be 10, etc...
Hoping this can help you !