I'm trying to make a script for a friend for War Thunder. He wants the reversing controls to be inverted, since he's used to it from World of Tanks. What I'm trying to do is whenever S is held, A and D are swapped. But the issue is that if S is released before A or D, it will keep sending the inverted input until the physical button is pressed.
Example:
1. I press S and A to reverse and turn, the hotkey correctly sends D instead of A.
2. I release S before releasing A.
3. The script keeps sending D, until the physical button for D is pressed.
What should happen is that the directions swap back as seamlessly as possible. Meaning if I'm holding down A, releasing S should just swap the direction. An acceptable alternative could be for the script to force the release of both A and D when S is released just to stop the issue happening. But I cant for the life of me figure out how to do either. I've tried all manner of SendInput and while loops etc.
Here's what I have currently:
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#InstallKeybdHook
#If GetKeyState("s","p") && WinActive("ahk_exe aces.exe")
$a::d
$d::a
#If