Need help with loop Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Qplshakyz
Posts: 35
Joined: 13 Apr 2021, 12:07

Need help with loop

13 Apr 2021, 19:15

At the moment my script sends the command that I want but I can’t figure out how to repeat the cycle infinitely until it finds a specific name in the Programm I’m running

Code: Select all

 F1:: 

Loop { 

Ifwinactive, remote 

Send, {enter down}
Sleep 5000
}

Return 
[Mod edit: [code][/code] tags added.]

What else do I need ?
User avatar
mikeyww
Posts: 26945
Joined: 09 Sep 2014, 18:38

Re: Need help with loop

13 Apr 2021, 19:25

Code: Select all

F1::
SetTitleMatchMode, 2
SoundBeep, 1500
WinWaitActive, remote
Send {Enter}
Return
Qplshakyz
Posts: 35
Joined: 13 Apr 2021, 12:07

Re: Need help with loop

13 Apr 2021, 19:31

Thanks for the fast respond but I think I explained it wrong so
When I press f1 it should start the loop

Button pressed is enter und goes to sleep for 6 seconds and after that I presses enter again over and over until name “primal” was found in game
User avatar
mikeyww
Posts: 26945
Joined: 09 Sep 2014, 18:38

Re: Need help with loop

13 Apr 2021, 19:43

Writing an accurate script is not possible with the information that you have provided, because "found in the game" could mean many things. If you are looking for the text in a control, then have a look at ControlGetText.
Qplshakyz
Posts: 35
Joined: 13 Apr 2021, 12:07

Re: Need help with loop

13 Apr 2021, 19:46

But how do I start a loop it seems like my script just sends the command enter down once and stops after that I would like to send the command enter down the wait 6 seconds and send enter down again over and over
User avatar
mikeyww
Posts: 26945
Joined: 09 Sep 2014, 18:38

Re: Need help with loop  Topic is solved

13 Apr 2021, 19:56

Code: Select all

F1::
SetTitleMatchMode, 2
SoundBeep, 1500
Loop {
 WinWaitActive, remote
 SoundBeep, 1300
 Gosub, Go
 SetTimer, Go, 5000
 WinWaitNotActive
 SetTimer, Go, Off
 SoundBeep, 1100
}
Go:
Send {Enter}
Return

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 94 guests