r/AutoHotkey • • 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 Upvotes

2 comments sorted by

1

u/Keeyra_ 1d ago edited 1d ago
#Requires AutoHotkey v2.0
#HotIf WinActive("ahk_exe Warframe.x64.exe")
':: {
    if !(GetKeyState("W", "P") || GetKeyState("A", "P") || GetKeyState("S", "P") || GetKeyState("D", "P")) {
        Send("{Numpad9}")
        return
    }
    KeyWait(ThisHotkey, "T0.15")
        ? Send("{Numpad8}")
        : (Send("{Numpad9 down}"), KeyWait(ThisHotkey), Send("{Numpad9 up}"))
}

untested

•

u/Lord_and_Savior_123 7h ago edited 7h ago

Gonna go try now, thanks!

You're goated at the game. Thank you. :)