Do not end the loop

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
erikgds
Posts: 23
Joined: 27 Feb 2021, 19:26

Do not end the loop

Post by erikgds » 27 Feb 2021, 19:34

[ Sorry for bad english ]

My script is activated while my key is pressed, when I stop pressing it it finishes the script until the end and stops, I wish that the moment I stopped pressing the key the script would not be executed until the end, yes it looks at the exact point where I stopped pressing the key


=================================================================================

Code: Select all

#SingleInstance Force
#InstallKeybdHook
#IfWinActive, ahkexe client.exe

;__
;__MANA + ICO__
$F1:: ;Htkey for activate macro
While GetKeyState("F1","P"){

Loop, 2
{
    Send, {F10} ;HOTKEY MANA POTION ( HOTKEY IN GAME)
    Sleep, 20
}
Sleep, 150
Loop, 3
{
    Send, {F1 2} ;HOTKEY ICO (HOTKEY IN GAME)
    Sleep, 20
}
Sleep, 143
}
Return
;__
;__SUPREME + ICO__
$F4:: ;HHtkey for activate macro
While GetKeyState("F4","P"){

Loop, 2
{
    Send, {F4} ;HOTKEY SUPREME
    Sleep, 20
}
Sleep, 150
Loop, 3
{
    Send, {F1 2} ;HOTKEY ICO
    Sleep, 20
}
Sleep, 143
}
Return
;__
;__
User avatar
mikeyww
Posts: 26944
Joined: 09 Sep 2014, 18:38

Re: Do not end the loop

Post by mikeyww » 27 Feb 2021, 20:56

You can add something like the following.

Code: Select all

F1 Up::Reload
Change ahkexe to ahk_exe.
User avatar
erikgds
Posts: 23
Joined: 27 Feb 2021, 19:26

Re: Do not end the loop

Post by erikgds » 27 Feb 2021, 22:27

would that make the macro stop as soon as i stop pressing the key without having to press a secondary key? could you show me the placement of this script using my script please? I'm newbie
mikeyww wrote:
27 Feb 2021, 20:56
You can add something like the following.

Code: Select all

F1 Up::Reload
Change ahkexe to ahk_exe.
User avatar
mikeyww
Posts: 26944
Joined: 09 Sep 2014, 18:38

Re: Do not end the loop

Post by mikeyww » 28 Feb 2021, 06:52

Yes. You can place this at the bottom of your script.
Post Reply

Return to “Ask for Help (v1)”