I started using AHK yesterday, so keep in mind that I have very basic knowledge. I wrote a script for a game, works great! But.. it's long and messy so I'm improving it now by adding things like brackets, loops and referencing some values etc. I need some help figuring out how to best alternate between 2 lines of code (commands?). The 2 lines in question are the ones i've put a comment on "-- Login --" and "-- Enter --". I'd ideally like a very simple solution. I've never used a counter before but I was thinking maybe starting a counter and each time it loops it will either "Login" if the number is uneven or "Enter" if it's even.
Essentially this but in actual working code:
Count (+1)
if (count = uneven)
"Login"
if (count = even)
"Enter"
I'm inserting it in to this code:
Code: Select all
{
Loop 10
{
mouseclick, left, %i%, %j%, 1, 0 ; -- Login --
; or
mouseclick, left, %k%, %l%, 1, 0 ; -- Enter --
Sleep 500
Loop 3
{
Send %A_Tab% ; -- Switch target --
Sleep 500
Send x ; -- Cast spell --
Loop 4
{
Sleep 2125
if ($stop)
{
return
}
}
}
}