Jump to content

Have code repeat +1 more times everytime it goes through loop


Recommended Posts

Everytime the code loops, I want

MouseClick("left", 721, 686, 1, 2.5)

sleep(2000)

to be repeated +1

So by the 4th loop, the above code would be used +4 more times than the others. is there a way to do this?

sleep(2000)
HotKeySet("{NumPadAdd}","getpos")
HotKeySet("{END}","quitme")
While 1
MouseClick("left", 718, 424, 1, 2.5)
sleep(2000)
MouseClick("left", 721, 686, 1, 2.5)
sleep(2000)
MouseClick("left", 487, 438, 1, 2.5)
sleep(2000)
MouseClick("left", 564, 467, 1, 2.5)
sleep(2000)
MouseClick("left", 16, 68, 1, 2.5)
Sleep(3000)
WEnd
func quitme()
exit
EndFunc
func getpos()
EndFunc
Link to comment
Share on other sites

Everytime the code loops, I want

MouseClick("left", 721, 686, 1, 2.5)

sleep(2000)

to be repeated +1

So by the 4th loop, the above code would be used +4 more times than the others. is there a way to do this?

sleep(2000)
HotKeySet("{NumPadAdd}","getpos")
HotKeySet("{END}","quitme")
While 1
MouseClick("left", 718, 424, 1, 2.5)
sleep(2000)
MouseClick("left", 721, 686, 1, 2.5)
sleep(2000)
MouseClick("left", 487, 438, 1, 2.5)
sleep(2000)
MouseClick("left", 564, 467, 1, 2.5)
sleep(2000)
MouseClick("left", 16, 68, 1, 2.5)
Sleep(3000)
WEnd
func quitme()
exit
EndFunc
func getpos()
EndFunc

Have a variable increment by 1 every loop (like $timesToRun), and for-next loop the command you want to repeat more often, like for $i = 1 to $timesToRun

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

$repeat = 1
sleep(2000)
HotKeySet("{NumPadAdd}","getpos")
HotKeySet("{END}","quitme")

While 1
    MouseClick("left", 718, 424, 1, 2.5)
    sleep(2000)
    For $i = 1 To $repeat
        MouseClick("left", 721, 686, 1, 2.5)
        sleep(2000)
    Next
    MouseClick("left", 487, 438, 1, 2.5)
    sleep(2000)
    MouseClick("left", 564, 467, 1, 2.5)
    sleep(2000)
    MouseClick("left", 16, 68, 1, 2.5)
    Sleep(3000)
    $repeat += 1
WEnd
func quitme()
exit
EndFunc
func getpos()
EndFunc

Edited by Siao

"be smart, drink your wine"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...