Holding down a hotkey counts as pressing it over and over?

Ask gaming related questions (AHK v1.1 and older)
LANZELLOTH
Posts: 6
Joined: 10 May 2022, 02:14

Holding down a hotkey counts as pressing it over and over?

Post by LANZELLOTH » 14 May 2022, 15:21

so I want something that spams Space every 0.2s when I hold space.
I thought that something like

Code: Select all

$Space:: ;down
	SetTimer, SpamJump, 500
return
$Space Up::
	SetTimer, SpamJump, off
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SpamJump:
	Send, {Space}
return
Would suffice, but it looks like $space is actually triggered over and over, I tried adding toggle variable inside, but that doesn't work and actually produce weird behavior


[Mod action: Moved topic to "Gaming"]

LANZELLOTH
Posts: 6
Joined: 10 May 2022, 02:14

Re: Holding down a hotkey counts as pressing it over and over?

Post by LANZELLOTH » 14 May 2022, 16:20

like

Code: Select all

a::
    Send, b
return
will spam b, when you hold down a

Rohwedder
Posts: 7628
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Holding down a hotkey counts as pressing it over and over?

Post by Rohwedder » 16 May 2022, 00:22

Hallo,
try:

Code: Select all

$Space:: ;down
IF SpamJump
	Return
SetTimer, SpamJump,% (500, SpamJump := True)
SpamJump: ; at Space Down and then every 500 ms until Space Up
Send, {Space}
Return
*Space Up::SetTimer, SpamJump,% ("Off", SpamJump := False)
"SpamJump" is used as label name and toggle variable.

Post Reply

Return to “Gaming Help (v1)”