r/AutoHotkey • u/Lord_and_Savior_123 • 1d ago
v2 Script Help Script Help Please !
Code is below. Where and how would i change this to where if i am not holding WASD, and just click the apostrophe('), it sends crouch and bypasses the timer? I'm trying to emulate controller movement on my MKB setup. I only wrote the window active line and the getkeystate lines, the rest I found online. Thanks!
#Requires AutoHotkey v2.0
#HotIf WinActive("ahk_exe Warframe.x64.exe")
^j::Send "Only runs in wf"
RollKey := "Numpad8" ; In-game Roll bind
CrouchKey := "Numpad9" ; In-game Crouch/Slide bind
HoldThreshold := 150 ; Milliseconds before treating press as a hold
':: {
if KeyWait("'", "T" . (HoldThreshold / 1000)) {
; Released before threshold -> Tap = Roll
if GetKeyState("W", "P") || GetKeyState("A", "P") || GetKeyState("S", "P") || GetKeyState("D", "P")
Send "{" RollKey "}"
} else {
; Held past threshold -> Hold = Crouch/Slide
Send "{" CrouchKey " down}"
KeyWait "'"
Send "{" CrouchKey " up}"
}
}
1
u/Keeyra_ 1d ago edited 1d ago
untested