Hi, im new to AHK and i never made a script my-self, and i want to know how can i make a loop macro, but i dont want to have a toggle button (like press f1 to activate, press again f1 to disactivate), i want a loop that its stopping when i release button T.
If anyone can help me that would be nice
Loop
Re: Loop
Hallo,
try:or with Exit inside every Sleep:
try:
Code: Select all
t::
While, GetKeyState("t","P")
{
SoundBeep, 4000, 20
Sleep, 200
SoundBeep, 1000, 20
Sleep, 200
}
Return
Code: Select all
t::
t Up::
While, Tdown := GetKeyState("t","P")
{
SoundBeep, 4000, 20
Sleep(200, TDown)
SoundBeep, 1000, 20
Sleep(200, TDown)
}
Return
Sleep(Time,ByRef Active:=True)
{ ;like "Sleep, Time", but if Active becomes False, the Thread ends
End:= A_TickCount + Time
While, S:= End-A_TickCount > 0
IF Active
Sleep,S>100?100:S
Else Exit
} ;a long Sleep will be segmented to be able to interrupt it fast
Re: Loop
Does it spam T?, like how csgo bhop does, it spam space when you press space, because here when i press t, it doesnt spam T after, if you understandRohwedder wrote: ↑06 Dec 2021, 03:51Hallo,
try:or with Exit inside every Sleep:Code: Select all
t:: While, GetKeyState("t","P") { SoundBeep, 4000, 20 Sleep, 200 SoundBeep, 1000, 20 Sleep, 200 } Return
Code: Select all
t:: t Up:: While, Tdown := GetKeyState("t","P") { SoundBeep, 4000, 20 Sleep(200, TDown) SoundBeep, 1000, 20 Sleep(200, TDown) } Return Sleep(Time,ByRef Active:=True) { ;like "Sleep, Time", but if Active becomes False, the Thread ends End:= A_TickCount + Time While, S:= End-A_TickCount > 0 IF Active Sleep,S>100?100:S Else Exit } ;a long Sleep will be segmented to be able to interrupt it fast
Re: Loop
You wrote:
i want a loop that its stopping when i release button T.
i.e. no hint that the loop should spam anything! In the current state the loop beeps.
i want a loop that its stopping when i release button T.
i.e. no hint that the loop should spam anything! In the current state the loop beeps.
Re: Loop
I must sound rude or like selfish, but can you please put only button t, to not spam anything, only if that is possible )
If not thats ok, i will try to find out a different way to fix it
Re: Loop
This?
Tilde: ~ prefix when the hotkey fires, its key's native function will not be blocked.
Replace:by: andby
Tilde: ~ prefix when the hotkey fires, its key's native function will not be blocked.
Replace:
Code: Select all
t::
Code: Select all
~t::
Code: Select all
t Up::
Code: Select all
~t Up::
Who is online
Users browsing this forum: Billykid and 181 guests