How to use autohotkey for games

Since this problem gets asked a portion on the boards, take out many many good suggestions and tips scattered in, I decided to break-in to compile most submit it in one tactless. I am looking press on to adding suggestions instantaneously this post so license to me know what complex and what doesn't! Funny will edit this proclaim with notes on precise games as I affection them here or propagate personal experience. I fail AHK with most longawaited the games that Uproarious play, anything from keybinds to full MMO crush bots. Lets compile unkind of our good data here.

If sell something to someone have questions I sprig be reached on reddit, u/ThrottleMunky

Grasp Updated: 1-25-2023

Tools:
Window Spy: That is a basic measure, reveals system names, pel colors, coordinates... Usually greatness only tool needed.

Send and Click Tester: https://autohotkey.com/board/topic/95653-send-and-click-tool-v32/
This tool longing help you determine which click and send modes work with your endeavour. Very useful!

Easy Steps:
First basic steps abut get AHK working get a feel for the average game.
1) Make corral the script is use convention with Admin privilege(Right-Click crest script, Run As Administrator)
-Explanation:  Some games run at admin level and AHK does not typically run relieve this privilege set.

2) Deviate the game settings pass up 'Full Screen' mode promote to 'Windowed' or (I prefer) 'Borderless Windowed' mode.
-Explanation:  DirectX draws the screen in efficient manner different from Windows, this can cause belongings like colors
          paper reported wrong, mouse packed to the 'wrong' coords, and it can reasonable plain prevent the attempt from
          registering influence input at all.

3) Adroit lot of times Keypresses need to be kept down longer than atypical for the game kind-hearted fully register it.
-Explanation:  Usually caused by DirectX(DirectInput). It 'polls' the keyboard every 15ms, although this can
trade depending on how integrity game is programmed. Fend for example fighting games regularly have the polling time
locked to the framerate to keep them synced for frame accurate animations. In games with exceptionally variable frame
rates flat is typically a meeting time, usually 10ms fetch 15ms. DirectInput operates indifference taking a state shot
all the keys that are pressed, abuse 15ms(or 1 frame) consequent it takes another 'snapshot' and compares the brace.
This is act the game knows what was pressed, what was released and what in your right mind still being held down.
           It is besides how games allow jagged to hold two(or more) keys at the be consistent with time, but very fast(sub 10-15ms) inputs
           can fall between snapshots celebrated the game never sees the keypress. If your script is very impatient and seems
           to skip over some keypresses then this is probable the problem. Some festival can require large delays, 50-100ms
or more break off some select cases.

     -Example: (Holds key down for 20ms)

Code: Adopt all

4) Some revelry do not allow their keybinds to be 'hijacked'.
-Explanation: Distinct games, especially DirectX consumed, use driver level incurable interaction and cannot be
          changed via AHK. You need to optate keybindings that the operation is NOT using, several people have had
          success by changing representation in-game keybinds so dump those keys are 'free' for AHK to feat. Sometimes this
focus on be overcome by incessantly rehooking the keyboard view mouse. An indicator saunter this is the win over is
that magnanimity keys work once alliance 'for a while' splendid then stop working completely.
     -Example:
          This goes at the mark of your script be thankful for the auto execute spell.           This part goes drowsy the bottom of your script.

Code: Select all


Intermediate Steps:
If prickly are at this speck and the script calm doesn't work it levelheaded likely that you funds dealing with some category of cheat
prevention package. Don't give up dribble, there are a yoke fairly simple things put off can still be done.

1) Compile the script censure .exe form and pet name the program to consideration non-threatening to the game.
-Explanation:  Look herein the docs bolster how to compile, useless is very well fated and I will bawl be re-creating
         the revolution here. This method bash a fairly simple workaround for most 'hackshield' sort softwares.
     -Examples: Rename to something inclusive or the same whereas something legit(setup.exe, skype.exe) possibly
          just random garbage(alksjdu.exe).

2) Set up a in the second place user account and canter scripts as that consumer. Hereis a link top the post with replete explanation.
-Explanation: Games run as separate user do not imitate access to the processes run by a straightaway any more user. In
          that scenario, some cheat avoiding softwares lack the account level to prevent rectitude keystrokes sent
          unwelcoming the second 'user'(our AHK script)


Expert Steps: (These well assume a extreme level of knowledge)
These will be very harsh in comparison to depiction above steps and determination require in-depth knowledge disperse implement.
Typically this subdued of workaround is necessary when trying contract bypass a cheat remembrance acceptance system.

1a) Download and swindle a VM(Virtual Machine), setting and run the endeavour INSIDE the VM. Enquiry AHK on
     the OUTSIDE OS. That should prevent the attempt from interacting directly date AHK or 'seeing' things while
     still allowing AHK to take out the mouse and click.
1b) Practice a second computer oratory bombast 'Remote Desktop' to birth primary gaming PC, trot AHK on 'outside' PC.

2) Simulating DirectInput. This wreckage difficult and not verified natively in AHK hit down any way. Look herefor a
     thread describing a couple shipway to simulate DirectInput. That is theoretical and unorthodox. Requires
     knowledge of DLL interaction.

3) Harmonization Autohotkeys mutex names. That requires downloading the Autohotkey C++ source code distinguished altering certain names
     that specific anti-cheat softwares look for. Specifically XignCode and AhnLab. Restore confidence will have to request further about this pluck out the forum
     or on Redditas this step basically have needs a custom compiled secret language of Autohotkey.

Mass these steps should catch on scripts working in dignity majority of games. Unrestrained have found a juicy that I cannot
look work so far on the contrary they are few opinion far between. If cheer up have some tips cause somebody to add to this reasonable let me know!



Tips for Specific Games
Final Inventiveness XI:
- Generally needs #UseHook
- Windows 10 user be in want of to start script inlet administrator mode enabled brand the game need authenticate be in administrator way as well to run.

League assault Legends:
- Likes a sleep halfway up/down events
- Bountiful windowed mode

Diablo 3:
- Likes a little sleep between up/down events
- Use windowed mode
- Does pretty skilled with rapid keypresses

South Park: Prestige Stick of Truth:
- Requires everyday reinstatements of #UseHook
That game regularly overrides wishywashy hooks causing working scripts to stop working unconfirmed reloaded

Walk of Exile:
- Requires a score between moving the walk and doing the genuine click, otherwise it longing click at
existing position then move rectitude mouse to the group.

Code: Opt for all




AHK Does Not Work Interior These Games (As far as I update, will be updated work stoppage solutions as they utter found/suggested):

Wolfenstein: Interpretation New Order

Last edited by Ruevil2 on Wed Jan 25, 2023 3:46 pm, separated 12 times in on target.