Sign in to follow this  
Followers 0
Guest BL@(K-R34P3R

Loop Inside of Loop

5 posts in this topic

Is it possible to use the same type of loop inside another loop? Here's an example of what I have right now:

WeaponFunc()
Func WeaponFunc()
   Sleep(2000)
   While 1
      Sleep(5000)
      Send("9")
      Sleep(5000)
      MouseDown("left")
      Sleep(1000)
      MouseUp("left")
      Sleep(5000)
      Send("f")
      Sleep(5000)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      MouseDown("left")
      Sleep(500)
      MouseUp("left")
      Sleep(500)
      Send("1")
      Sleep(5000)
      MouseDown("left")
      Sleep(1000)
      MouseUp("left")
      Sleep(5000)
      Send("2")
      Sleep(5000)
      MouseDown("left")
      Sleep(1000)
      MouseUp("left")
      Sleep(5000)
   Wend
EndFunc

I want to edit it so that instead of typing Sleep(500)

MouseDown("left")

Sleep(500)

MouseUp("left")

Sleep(500)

each time I will just write another loop inside of the current While 1 loop, and make a counter to stop it after 60 times around. Is this possible?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

A quick sorten of your code:

WeaponFunc()
Func WeaponFunc()
  Sleep(2000)
  While 1
     Sleep(5000)
     Send("9")
     Sleep(5000)
     MouseDown("left")
     Sleep(1000)
     MouseUp("left")
     Sleep(5000)
     Send("f")
     Sleep(5000)

     for $i = 1 to 50
     MouseDown("left")
     Sleep(500)
     MouseUp("left")
     Sleep(500)
     next
     
     Send("1")
     Sleep(5000)
     MouseDown("left")
     Sleep(1000)
     MouseUp("left")
     Sleep(5000)
     Send("2")
     Sleep(5000)
     MouseDown("left")
     Sleep(1000)
     MouseUp("left")
     Sleep(5000)
  Wend
EndFunc

change the 50 to 60, but by my count you repeated 50 times.

Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Thanks, exactly what I was looking for.

Share this post


Link to post
Share on other sites

BTW, if this is a game macro and you have two computers, you can also have autoit read info from files, or existance of files.

I have one computer at work run a query and output a file whenever it finds a new imput file on the server in a certain directory. That is done in AutoIt. So if you can't get start and stop via keys, you could try changing a file through the network, or even email via your phone. I have made scripts that started when a website updated thier page. Nice to have current prices. :) Possiblities are endless.


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

That does sound tempting, but this is just a private script for a game bot. Nothing important. Besides, the game is singleplayer, not online. So it really serves no real purpose.

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