Sign in to follow this  
Followers 0
Arez

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

4 posts in this topic

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

I'm lost here. how would I implement that in the middle of the code?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

$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"

Share this post


Link to post
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
Sign in to follow this  
Followers 0