enabling the script after the holding time Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Dad

enabling the script after the holding time

08 Aug 2018, 12:34

Hello,
I need help, I would ask someone to "do" such a simple script, because i never "created" any scripts, if someone wants help i need a script:
when I pressed key ( mouse1 ) for 3 seconds, it will turn on the script ( e.g SoundBeep, 1000, 100 ) after releasing button - so if I held key <3secs, it will not turn it on
Rohwedder
Posts: 7628
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: enabling the script after the holding time

09 Aug 2018, 01:39

Hallo,
try:

Code: Select all

;~ key's native function will not be blocked
;* fire the hotkey even if extra modifiers are being held down
~*LButton::
KeyWait, LButton
If A_TimeSinceThisHotkey < 3000
	Return
SoundBeep, 1000, 100
Return
dad

Re: enabling the script after the holding time  Topic is solved

09 Aug 2018, 17:03

Thank you for fast help, but could you add one fuction ? When i holding lbutton>3sec, and i push button or buttons ( in this same time ) e.g W S A, it will not work my "beep" ;) ?
Rohwedder
Posts: 7628
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: enabling the script after the holding time

10 Aug 2018, 00:34

Hallo,
A_TimeSinceThisHotkey was reset when you pressed hotstrings.
Better?:

Code: Select all

~*LButton::
TLButton := A_TickCount
KeyWait, LButton
If (A_TickCount - TLButton < 3000)
	Return
SoundBeep, 1000, 100
Return
dad
Posts: 1
Joined: 10 Aug 2018, 14:59

Re: enabling the script after the holding time

10 Aug 2018, 16:04

Alo !
the first script you gave, everything okey . I only miss the option as I wrote:
When I hold the W button ( before lbutton), and if I will hold the buttons A S D, it will not run my "SoundBeep, 1000, 100".
Rohwedder
Posts: 7628
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: enabling the script after the holding time

10 Aug 2018, 23:43

Hallo,
WASD are the Arrow keys of a Game?
Then: https://autohotkey.com/board/topic/1117 ... he-basics/

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 84 guests