how to put the loop on hold of the button Topic is solved

Ask gaming related questions (AHK v1.1 and older)
tomkruz
Posts: 31
Joined: 23 Aug 2021, 02:32

how to put the loop on hold of the button

25 Sep 2021, 14:48

Code: Select all

loop
{

 
if (b>a)
		{
    			send {c}
		}

Sleep 5

}
who will tell you how to make a cycle on holding the key so that it stops working after the release (or pause on the button)
User avatar
mikeyww
Posts: 26939
Joined: 09 Sep 2014, 18:38

Re: how to put the loop on hold of the button  Topic is solved

25 Sep 2021, 17:15

Code: Select all

a := 1, b := 2
F3::
If (b > a) ; Check only once
 While GetKeyState(A_ThisHotkey, "P") {
  Send c
  Sleep, 15
 }
Else KeyWait, %A_ThisHotkey%
SoundBeep, 1000
Return
To keep checking:

Code: Select all

a := 1, b := 2
F3::
While GetKeyState(A_ThisHotkey, "P") {
 Send % b > a ? "c" : "" ; Check with each iteration
 Sleep, 15
}
SoundBeep, 1000
Return

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 96 guests