Skip to content

Instantly share code, notes, and snippets.

@1player
Created February 8, 2021 10:47
Show Gist options
  • Save 1player/5642109467fe21c5af673151b956b27b to your computer and use it in GitHub Desktop.
Save 1player/5642109467fe21c5af673151b956b27b to your computer and use it in GitHub Desktop.
Toggle sprint AutoHotKey script for Squad
#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.
#IfWinActive, SquadGame
; 0=walk, 1=hold sprint, 2=toggle sprint
mode := 0
XButton2::
If (A_PriorHotkey == "XButton2" || A_PriorHotKey == "XButton2 UP") && (A_TimeSincePriorHotkey < 300) {
If (GetKeyState("w", "P")) {
SendInput {LShift down}
mode := 2
}
} Else {
SendInput {LShift down}
mode := 1
}
return
+XButton2::
If (mode == 2) {
SendInput {LShift up}
mode := 0
}
return
XButton2 UP::
If (mode == 1) {
SendInput {LShift up}
mode := 0
return
}
return
~*w UP::
If (mode == 2) {
SendInput {LShift up}
mode := 0
}
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment