Jump to content
Sign in to follow this  
FrozenScriptz

Please Read this

Recommended Posts

FrozenScriptz

Hello so ive been wondering how do I make my script run multiple times?

like a mouse will click on a pixel that the pixel search has found and I want my script to do it again.

Example Code:

$var1 = PixelSearch ( 0,0, 1279, 1023, 0xFF0000 )
If Not @error Then
MouseClick("Left", $var[0], $var[1], 1)
EndIf

I know I need to use Do or While Loop but I don't know how to use them well.

Share this post


Link to post
Share on other sites
jaenster

I guess you are learning autoit.

Well it is kinda simpel, look at the helpfile or autoit3\Examples\Helpfile\For.au3


-jaenster

Share this post


Link to post
Share on other sites
Shiro

Some kind of loop like

For...Next

While...WEnd


Share this post


Link to post
Share on other sites
FrozenScriptz

Okay I'll try those :mellow:

Share this post


Link to post
Share on other sites
FrozenScriptz

Thanks guys I tried to code on myself by using while but didn't try do yet, but while is cool and its too fast :mellow:

Share this post


Link to post
Share on other sites
FrozenScriptz

So its gonna be like this?

$t = 0
while $t < 10 
msgbox(0,"","Hi")
$t = $t + 1
wend
sleep(1000)

Please reply quick

Share this post


Link to post
Share on other sites
sahsanu

You should put the Sleep inside the While loop.

$t = 0
while $t < 10 
msgbox(0,"","Hi")
$t = $t + 1
sleep(1000)
wend

Edit: I didn't see your "Please reply quick" and I agree Tvern, that isn't the right way to ask for help.

Edited by sahsanu

Share this post


Link to post
Share on other sites
Tvern

Your sleep will only be executed when the loop is finished.

You'd want your code to look liek this.

Local $t = 0
While $t < 10
    MsgBox(0,"","Hi")
    Sleep(1000) ;put the sleep inside the loop
    $t += 1 ;this is another way to increate $t by 1
Wend

A For...To...Next loop would be better for this code:

For $t = 0 To 9 ;this declares $t and automatically increments it by 1, untill $t is 9 at which point the loop will run one last time before it exits.
    MsgBox(0,"","Hi")
    Sleep(1000)
Next

Please reply quick

That almost stopped me from replying. I doubt anyone will feel more inclined to help you if you tell em to be quick about it.

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  

×