Loken Posted January 7, 2011 Posted January 7, 2011 (edited) 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 January 7, 2011 by Loken
JohnOne Posted January 7, 2011 Posted January 7, 2011 (edited) Fix your code tags[code]code inside[/code]EDIT:I see you already did Edited January 7, 2011 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
JohnOne Posted January 7, 2011 Posted January 7, 2011 5 seconds is Sleep(5000) its counted in miliseconds. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Loken Posted January 7, 2011 Author Posted January 7, 2011 Fix your code tags [code] code inside [/code] EDIT: I see you already did I'm fixed thank you
Loken Posted January 7, 2011 Author Posted January 7, 2011 (edited) 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 Edited January 7, 2011 by Loken
JohnOne Posted January 7, 2011 Posted January 7, 2011 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.
Loken Posted January 7, 2011 Author Posted January 7, 2011 (edited) JohnOne not work Sleep until find pixel but maximum 5000 Edited January 7, 2011 by Loken
JohnOne Posted January 7, 2011 Posted January 7, 2011 Try using google translate and explain in you native languge what you want to do, because Im not understanding it. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Loken Posted January 7, 2011 Author Posted January 7, 2011 $pc=0xFEFEFE Sleep(5000) but if find $pc exitSleep or exitloop. do you understand?
JohnOne Posted January 7, 2011 Posted January 7, 2011 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.
Loken Posted January 7, 2011 Author Posted January 7, 2011 Not work again my sciprt is here. 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
JohnOne Posted January 7, 2011 Posted January 7, 2011 So do you want it to just sleep, and then wake up when the pixel appears? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Loken Posted January 7, 2011 Author Posted January 7, 2011 So do you want it to just sleep, and then wake up when the pixel appears?yes i want it huuh
JohnOne Posted January 7, 2011 Posted January 7, 2011 Thought so. I'm sorry to inform you that it's just not possible. You have to keep checking for the pixel in order for your script to know when it appears. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
MrPPP Posted January 7, 2011 Posted January 7, 2011 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;)
Loken Posted January 8, 2011 Author Posted January 8, 2011 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.
MrPPP Posted January 8, 2011 Posted January 8, 2011 thank you very much your command working.Nice;)Good luck!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now