On second thought, after re-reading your request, I think I realized what you want. You want something that'll spam parry while you're holding down the directional buttons, correct?
if so, I built this up a bit to be a bit fancier, and to do what I THINK you're wanting.
Tested it briefly on my end and it works pretty flawlessly. I've added notes on what I'm doing. You generally want to use subroutine labels where you can in place of While and KeyWait, otherwise you risk locking up your script because lmao threading.
Code: Select all
global isHoldingF := "0" ;The player is holding the F key
global parryType := "None" ;The parry to execute
global framesPerSecond := "60" ;Game's FPS
global gameTick := ((1/framesPerSecond)*1000) ;One gametick / frame
global useTestBeep := "1" ;Enable test beeps
tick(t:="1"){ ;Tick function.
ticks := gameTick*t ;Set "Ticks" value to GameTicks times passed tick count value.
return ticks ;Return the "Ticks value."
}
testBeep(freq:="0", duration:="0"){ ;Test beep function.
if useTestBeep{ ;If useTestBeeps variable is 1,
Soundbeep, freq, duration ;Play a beep based on the passed frequency/duration values.
}
return
}
F5:: ;F5 press.
send {F5} ;Sent vanilla F5 keystroke.
reload ;Reload the script.
return
*$~F:: ;F press. (*$~ prefix)
testBeep(1800, 15) ;Play the F Pressed beep.
isHoldingF := "1" ;Set "IsHoldingF" check to true.
return
*$~F Up:: ;F release. (*$~ prefix)
testBeep(900, 30) ;Play the F Released beep.
isHoldingF := "0" ;Set "IsHoldingF" check to false.
return
$W:: ;W press. ($ prefix)
if isHoldingF{ ;If F is held,
ParryType := "Up" ;Set parry type to "Up",
goSub Parry ;Go to the parry subroutine.
}
else if !isHoldingF{ ;Otherwise, if F is NOT held,
send {w} ;Send vanilla "W" keystroke.
}
return
$A::
if isHoldingF{ ;A press. ($ prefix)
parryType := "Left" ;If F is held,
goSub Parry ;Set parry type to "Left",
} ;Go to the parry subroutine.
else if !isHoldingF{
send {a} ;Otherwise, if F is NOT held,
} ;Send vanilla "A" keystroke.
return
$S:: ;S press. ($ prefix)
if isHoldingF{ ;If F is held,
parryType := "Down" ;Set parry type to "Down",
goSub Parry ;Go to the parry subroutine.
}
else if !isHoldingF{ ;Otherwise, if F is NOT held,
send {s} ;Send vanilla "S" keystroke.
}
return
$D:: ;D press. ($ prefix)
if isHoldingF{ ;If F is held,
parryType := "Right" ;Set parry type to "Right",
goSub Parry ;Go to the parry subroutine.
}
else if !isHoldingF{ ;Otherwise, if F is NOT held,
send {d} ;Send vanilla "D" keystroke.
}
return
$W up::
$S up::
$A up::
$D up:: ;For W, S, A, and D releases,
if isHoldingF{ ;If F is held,
testBeep(220, 30) ;Play key release beep.
}
parryType := "None" ;Unset the ParryType value.
return
Parry: ;Parry subroutine
{
setTimer, Parry, off ;Disable the subroutine loop,
if isHoldingF{ ;If F is held,
switch parryType{ ;Look at the current ParryType value
case "Up": ;For up,
moveMouse(0, -50, 5) ;Move mouse up
case "Down": ;For down,
moveMouse(0, 50, 5) ;Move mouse down
case "Left": ;For left,
moveMouse(-50, 0, 5) ;Move mouse left
case "Right": ;For right,
moveMouse(50, 0, 5) ;Move mouse right
case "None": ;For none,
testBeep(300, 30) ;Play exit beep,
setTimer, Parry, off ;Disable the loop
default: ;Fallback,
testBeep(150, 45) ;Play error beep,
setTimer, Parry, off ;Disable the loop
}
}
return
}
moveMouse(X:="0",Y:="0",Duration:="0"){ ;Move mouse function.
testBeep(600, 15) ;Play mouse move beep,
MouseMove, X, Y, Duration, R ;Move the mouse based on passed X/Y/Duration values,
setTimer, Parry, % tick(2) ;Return to Parry subroutine in 2 ticks.
return
}