Tools:
Send and Click Tester: https://autohotkey.com/board/topic/9565 ... -tool-v32/
This tool will help you determine which click and send modes work with your game. Very useful!
Easy Steps:
First basic steps to get AHK working with the average game.
1) Make sure the script is running with Admin privilege(Right-Click on script, Run As Administrator)
-Explanation: Some games run at admin level and AHK does not typically run with this privilege set.
2) Switch the game settings from 'Full Screen' mode to 'Windowed' or (I prefer) 'Borderless Windowed' mode.
-Explanation: DirectX draws the screen in a manner different from Windows, this can cause things like colors
being reported wrong, mouse jumping to the 'wrong' coords, and it can just plain prevent the game from
registering the input at all.
3) A lot of times Keypresses need to be held down longer than normal for the game to fully register it.
-Explanation: Usually caused by DirectX(DirectInput). It 'polls' the keyboard every 15ms(varies slightly) and
records the keys that are down, then 15ms later it takes another 'snapshot' and compares the two. This
is how games allow you to hold two(or more) keys at the same time, but very fast(sub 10-15ms) inputs
can fall between snapshots and the game never sees the keypress. If your script is very twitchy and seems
to skip over some keypresses then this is likely the problem. Some games can require large delays,
50-100ms or more in some select cases.
-Example: (Holds key down for 20ms)
Code: Select all
Send, {a down}
Sleep 20
Send, {a up}
-Explanation: Many games, especially DirectX driven, use driver level keyboard interaction and cannot be
changed via AHK. You need to choose keybindings that the game is NOT using, some people have had
success by changing the in-game keybinds so that those keys are 'free' for AHK to use.
Intermediate Steps:
If you are at this point and the script still doesn't work it is likely that you are dealing with some sort of cheat
prevention software. Don't give up hope, there are a couple fairly simple things that can still be done.
1) Compile the script to .exe form and rename the program to something non-threatening to the game.
-Explanation: Look here in the docs for how to compile, it is very well written and I will not be re-creating
the wheel here. This method is a fairly simple workaround for most 'hackshield' type softwares.
-Examples: Rename to something generic or the same as something legit(setup.exe, skype.exe) possibly
just random garbage(alksjdu.exe).
2) Set up a second user account and run scripts as that user. Here is a link to the post with full explanation.
-Explanation: Games run as one user do not have access to the processes run by a second user. In
this scenario, some cheat prevention softwares lack the access level to prevent the keystrokes sent
by the second 'user'(our AHK script)
Expert Steps: (None of these are verified or easy to use)
These are mostly theory at this point. These will be very difficult and will require in-depth knowledge to implement.
(if you try any of these ideas with success let me know, i will update this)
1) Download and setup a VM(Virtual Machine), install and run the game INSIDE the VM. Run AHK on
the OUTSIDE OS. This should prevent the game from interacting directly with AHK or 'seeing' it while
still allowing AHK to move the mouse and click.
2) Simulating DirectInput. This is difficult and not supported natively in AHK in any way. Look here for a
thread describing a couple ways to simulate DirectInput. This is theoretical and untested. Requires
knowledge of DLL interaction.
3) Altering Autohotkeys mutex names. This requires downloading the Autohotkey source code and altering certain names
that specific anti-cheat softwares look for. Namely XignCode and AhnLab. You will have to ask further about this as
this step basically requires a custom compiled version of Autohotkey.
Following these steps should get scripts working in the majority of games. I have found a few that I cannot
make work so far but they are few and far between. If you have some tips to add to this please let me know!
Tips for Specific Games
Final Fantasy XI:
- Generally needs #UseHook
- Windows 10 user need to start script in administrator mode enabled as the game need to be in administrator mode as well to run.
League of Legends
- Likes a sleep between up/down events
- Use windowed mode
AHK Does Not Work In These Games(As far as I know, will be updated with solutions as they are found/suggested):
Wolfenstein: The New Order