Rebinding WASD with AutoHotkey (no more accidental cheats)
6 years ago
United States

Hello,

Losing runs to WASD cheats is bullshit. At least I think it is; I don't particularly enjoy the "skill" involved in avoiding those cheats - to me it feels like being punished for trying to navigate the game world efficiently. Nonetheless, there is a speedrun-legit, free and easy way to entirely avoid losing runs to accidental cheats. It's called the magic of AutoHotkey.

If you don't have AHK, head over to this handy dandy link: https://autohotkey.com/download/ and install it, or download the .zip, whatever your fancy is.

Download and set it up. Now, open up your copy of San Andreas and rebind your movement keys to ones that are not part of any cheats. Personally, I use F5 for W, F6 for D, F7 for A and F8 for D. You must apply these bindings to both FOOT and VEHICLE controls, lest you become quickly confused when you hop on the bike and CJ takes a siesta.

https://i.imgur.com/fB9PTp3.png

https://i.imgur.com/Tyh6RLO.png

With that done, right click on your desktop (or anywhere in Explorer) and select New -> AutoHotkey script.

https://i.imgur.com/eENR2iY.png

If the option is not there, just make a new text document and change the file extension to .ahk. Right click on it, and select the "edit script" option. Notepad should open up with a blank file. You will want to setup your script like this:

https://i.imgur.com/cS3BGBU.png

SingleInstance Force to ensure that multiple and/or old instances do not run. UseHook to prevent the "too many hotkeys" popup. IfWinActive GTA: San Andreas so that your hotkeys are only enabled when you're in the SA window. SeemsGood

Running an .ahk script is easy. Just double-click on it (after you've saved it), and you're good to go. To exit the script, find it in your taskbar and right click -> exit script. The icon will be the little green "H" (or green "S" if you've got the script suspended).

https://i.imgur.com/SgCazk3.png

You've got it all set up! GG. Go out there and do some runs without fear of being a dirty little accidental cheater.

Edited by the author 6 years ago
gui93, Uppermost and 20 others like this
United Kingdom

Correct me if I'm wrong, but I think it's also worth mentioning that you should only rebind them to "weird" keys, like the function keys, otherwise you're just running the risk of using an HJKL cheat, or whatever keys you use.

LaserTrent likes this

"skill" involved in avoiding those cheats - to me it feels like being punished for trying to navigate the game world efficiently

Yea backing you on this one. I used to be 50/50 on the issue but I think this put me over the edge. Didn't someone make some program to avoid those cheats few months ago. I don't see a reason not to allow that one, either.

Edited by the author 6 years ago
PizzaFourLife likes this
Germany

I have things to add:

  1. The other way around is better: Run the script, then bind the keys in-game. Press W, it will bind it to F8 as it is supposed to.

  2. There is no need to manually suspend the script with `. See my scripts at the end.

  3. If you run the game as admin, you need to double-click some script I provide once. Or you start the rebinding script as admin every time.

  4. Put the script into the Windows startup directory. Since it only does something when SA is active, it is fine to have it running all the time. To get to the startup directory: Press Windows Key + R and then type (paste^^) something (depends on your OS), then press return. If Windows 8/10: type shell:startup (this applies only to you, for all users, use shell:common startup ) If Windows 7: type %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup (this applies only to you, for all users, use C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup )

I have made some ready-made scripts. a) full_version rebinds more than WASD: It rebinds these buttons, too: q, e, f, v, c. (failing at Vice City ;) ) Feel free to edit. Key names to use b ) wasd_version only rebinds WASD ;) Both have an as_admin version, too (if you run the game as admin). I recommend just double-clicking the script "EnableUIAccess.ahk" instead so that admin rights (clicking "yes" on the UAC prompt) are unnecessary. Download everything from here

I have tried making the script run gta_sa (Run, path to GTASA without quotes) but SA simply got stuck - weird.

Edited by the author 6 years ago
KinzyKenzie, hoxi and 2 others like this
Germany

Fixed, thanks.

Edited by the author 6 years ago
Russia

https://i.imgur.com/5htrUfE.png

Well I guess that's a rip for SKEYS. Because the program thinks I press that buttons I've binded by using a script. Nohboard seems to be working fine though.

Poland

@D0moTheRussian What did you expect? Also who cares about Skeys expect for holding calls?

Russia

@Kamiks0320 Me, for example. It believe it helps with understanding certain tricks and glitches. I still don't fully understand how to do the animation canceling during home invasion. KZ FREWs video with his nohboard layout helps with that.

Germany

@Kamiks0320 Don't get banned. ^^ Remember, don't be shit or contribute.

It is not clear that rebinding with a script would change SKeys. SKeys could operate at a lower level than AutoHotkey.

Edited by the author 6 years ago
Friesland, Netherlands

S Keys displays whatever is pressed after AHK has taken effect. I remember spacebar spam for DWAHMOV showing up as really flashy.

That said, I'm not opposed to anything that prevents WASD cheats, as long as they prevent the specific driving lines done by those keys as well.

United States

@S. so in that sense you would prefer using a script that blocks the last input of a cheat? For example, if you typed DDDDDDAAAAAADW, pressing D to "complete" the cheat blocks the input. You wouldn't be able to use D until another key is pressed to "invalidate" the cheat.

Someone made a script that does just that if I recall (the one @Shadow_Dog mentioned)

Russia

@KZ_FREW https://www.speedrun.com/gtasa/thread/qgubv - Probably this. I tried it out for a bit and it seems to be working. But for those who run on steam version (Looking at hundo runners). It will give them an "Unsupported EXE" error.

KZ_FREW likes this
Bulgaria

I guess this is the place to ask. When I have an ahk script on sometimes it likes to tab me out of my game. Does anyone know how to prevent it from happening?

Edited by the author 6 years ago
PizzaFourLife likes this
Germany

Andra got a message about too many hotkeys fired, I raised the limit. The download link is always the same if you need the update. https://www.dropbox.com/sh/iujghjkrock612n/AAC_JvGeSTEc_b6fVqLYGbpza?dl=1

United States

@Marushko I've added a fix to the OP. After some tweaks of the script, what I use now looks like this: https://i.imgur.com/cS3BGBU.png

Edited by the author 6 years ago
Germany
  1. I should also add #UseHook to my scripts when I reboot back to "general usage" Windows.

E: removed bullshit^^

Edited by the author 6 years ago
Germany

^ I did that, now.

I also removed the asterisks: [quote] Should add that if you don't have an asterisk before the hotkey it won't work if you're holding down a modifier key (like shift) so eg W should be "(asterisk)w::f5"

E: thanks speedrun.com markdown for being horrible. Hopefully this still makes sense. [/quote]

Both the documentation and my testing disagree. [quote]Holding down a modifier such as Control or Shift while typing the origin key will put that modifier into effect for the destination key. For example, b::a would produce Control-A if you press Control-B. [/quote]

I used this to test (both with and without #UseHook). https://pastebin.com/ghr6ER86

Edited by the author 6 years ago
Friesland, Netherlands

Yes Frew, scripts like that are totally fine by me.

France

Kinda late to the game and everyone probably already thought about it but maybe changing the keyboard layout could help ?

I'm using an AZERTY keyboard (a french one), anyone can download the layout through windows languages settings though. You can even hot-switch between the layouts with a shortcut or using the taskbar (if you want your keyboard back to QWERTY when not running for instance).

After ~140 LS any% attemps I never entered a cheatcode by mistake, for driving you then use ZQSD instead of WASD. Maybe my playing time isnt enough to be sure that no cheatcodes can be activated that way though. I'm not aware of how frequent it is with a QWERTY layout.

Sorry if that's not a solution to that problem.

Edited by the author 6 years ago
Germany

That can be done. There has been a simulation for which layout is best, but with unsubstantiated assumptions (how often which button is pressed). This layout won: Dvorak for people who only have a left hand.

You can use Microsoft Keyboard Layout Creator to create something even better (I don't know how you would do that. You cannot map WASD to "non-cheat keys" (like F-keys) with it).

Partial source: https://www.speedrun.com/gtasa/thread/g16eb

Edited by the author 6 years ago
fredonizuka likes this
Game stats
Followers
3,495
Runs
3,240
Players
545
Latest news
Changes to the GTA:SA leaderboard

The GTA:SA community has been deteriorating over a long period of time. Many top runners are not currently present on the leaderboard. This issue has not been seriously addressed yet, but an attempt will be made to remedy it now.

As of this news post, the San Andreas leaderboard will function in

1 year ago
Latest threads
Posted 1 year ago
0 replies
Posted 2 years ago
Posted 5 years ago
0 replies
Posted 6 years ago
0 replies