Jump to content
Sign in to follow this  
Loken

Sleep options

Recommended Posts

Hi everyone.My sciprt working good.I use while-wend commands for sleep until find(Call,True) pixel. But if script click on false pixel(sometimes pixel may be confusion), Sciprt'll not work.

$BoxColour=0x8E837F 
$WaitPixelColor=0xFEFEFE 
$Box = PixelSearch (80,65,1382,754, $BoxColour,8,4)
If IsArray($Box)=True Then
MouseClick("left",$Box[0], $Box[1], 1,5)
If isarray($Box)=True Then
$waitpixel=PixelSearch (655,405,695,460, $WaitPixelColor,8,4)
If isarray($waitpixel)=False Then
While 1     
$waitpixel=PixelSearch (655,405,695,460, $WaitPixelColor,8,4)
If Not @error Then ExitLoop     Sleep( Sleep(;How can i use sleep(maximum 5 second)) 
WEnd
Edited by Loken

Share this post


Link to post
Share on other sites

5 seconds is Sleep(5000) its counted in miliseconds.

No I'ld like to sleep until find pixel colour. But not long time maximum 10 second and this can may be 1 sc or 15 scnd.

anyone know? i need :x

Edited by Loken

Share this post


Link to post
Share on other sites

Then use a variable

$iDelay = 5000
$waitpixel=PixelSearch (655,405,695,460, $WaitPixelColor,8,4)
If Not @error Then ExitLoop     
Sleep($iDelay)
WEnd

The thing is you are going to have to define your delay time somewhere. It cannot sleep and still look for a pixel, Sleep() is a function too.

I think you need to explain a little more, because you have to keep searching for a pixel, of it wont know when its there/


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Yes I do, at least I think I do.

$Timer = TimerInit() ; set a timestamp
While 1
$waitpixel=PixelSearch (655,405,695,460, $WaitPixelColor,8,4) ; search for pixel
If Not @error Then ExitLoop ; if find pixel exitloop    
If $Timer >= 5000 Then ExitLoop ; if 5 seconds has passed exitloop
WEnd

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Not work again my sciprt is here.:x:P:shifty::nuke:

While 1

$Kuturenk=0x8E837F ;0x6E6AC8
$Toplarken=0xFEFEFE ;0x7CAEB6
$topla=PixelSearch (655,405,695,460, $Toplarken,8,4)


$Kutu = PixelSearch (80,65,1382,754, $Kuturenk,8,4)
 If IsArray($Kutu)=True Then
MouseClick("left",$Kutu[0], $Kutu[1], 1,5)
 If IsArray($Kutu)=True Then
$iDelay = 5000
If IsArray($Kutu)=True Then

$Timer = TimerInit() ; set a timestamp
While 1
$Devam=PixelSearch (664,373,720,435, $Toplarken,8,4) ; search for pixel
If Not @error Then ExitLoop ; if find pixel exitloop
Sleep(10)
If $Timer >= 5000 Then ExitLoop ; if 5 seconds has passed exitloop
WEnd

EndIf
EndIf
EndIf
WEnd

Script is not sleep

Share this post


Link to post
Share on other sites

Try it like this:

While 1

$Kuturenk=0x8E837F ;0x6E6AC8
$Toplarken=0xFEFEFE ;0x7CAEB6
$topla=PixelSearch (655,405,695,460, $Toplarken,8,4)


$Kutu = PixelSearch (80,65,1382,754, $Kuturenk,8,4)
 If IsArray($Kutu)=True Then
MouseClick("left",$Kutu[0], $Kutu[1], 1,5)
 If IsArray($Kutu)=True Then
$iDelay = 5000
If IsArray($Kutu)=True Then

$Timer = TimerInit() ; set a timestamp
While 1
$Devam=PixelSearch (664,373,720,435, $Toplarken,8,4) ; search for pixel
If Not @error Then ExitLoop ; if find pixel exitloop
Sleep(10)
If TimerDiff ($Timer) >= 5000 Then ExitLoop ; if 5 seconds has passed exitloop
WEnd

EndIf
EndIf
EndIf
WEnd

The TimerDiff() I added is used to check the time that has passed since you used TimerInit(). I think it should work now;)

Share this post


Link to post
Share on other sites

Try it like this:

While 1

$Kuturenk=0x8E837F ;0x6E6AC8
$Toplarken=0xFEFEFE ;0x7CAEB6
$topla=PixelSearch (655,405,695,460, $Toplarken,8,4)


$Kutu = PixelSearch (80,65,1382,754, $Kuturenk,8,4)
 If IsArray($Kutu)=True Then
MouseClick("left",$Kutu[0], $Kutu[1], 1,5)
 If IsArray($Kutu)=True Then
$iDelay = 5000
If IsArray($Kutu)=True Then

$Timer = TimerInit() ; set a timestamp
While 1
$Devam=PixelSearch (664,373,720,435, $Toplarken,8,4) ; search for pixel
If Not @error Then ExitLoop ; if find pixel exitloop
Sleep(10)
If TimerDiff ($Timer) >= 5000 Then ExitLoop ; if 5 seconds has passed exitloop
WEnd

EndIf
EndIf
EndIf
WEnd

The TimerDiff() I added is used to check the time that has passed since you used TimerInit(). I think it should work now;)

thank you very much your command working.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...