Results 1 to 2 of 2
  1. #1
    CovenOfDarkBon's Avatar
    Join Date
    Apr 2020
    Gender
    male
    Posts
    3
    Reputation
    10
    Thanks
    0

    A question to an experienced developers

    So I try to implement a macro using win32api, so far I tried SendInput and PostMessage functions. I run it elevated and with different delays, but they only seem to affect the games console. Does the game use some other way to gather events? (Using a microcontroller akin to rubberducky usb does work).

  2. #2
    Sharkaz's Avatar
    Join Date
    Jan 2016
    Gender
    male
    Posts
    12
    Reputation
    10
    Thanks
    1
    My Mood
    Relaxed

    PostMessage

    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 !

Similar Threads

  1. [Info] I'm looking for a experienced developer!
    By Argos60 in forum C# Programming
    Replies: 0
    Last Post: 01-18-2021, 10:45 PM
  2. [Hiring] Need experienced Developers
    By Vox in forum Work & Job Offers
    Replies: 0
    Last Post: 06-04-2020, 06:52 AM
  3. [Help Request] Need help, i have some questions about csgo cheat development
    By Mucroce in forum Counter-Strike 2 Help
    Replies: 2
    Last Post: 02-07-2019, 07:10 AM
  4. [WTS] Word Press Site Development // Fast and Cheap // Experienced Developer
    By Deep Breaths in forum User Services
    Replies: 9
    Last Post: 01-14-2017, 05:55 AM
  5. Question To ANY Experienced C++ Coder (who Has Made Hacks For Games)
    By OmEgaGaMeHaXor in forum C++/C Programming
    Replies: 25
    Last Post: 12-02-2009, 07:47 PM