nyxx24 Posted January 7, 2009 Posted January 7, 2009 (edited) Hey guys,My goal here is to skip a 35 second wait and the steps that go with it, if it's not necessary sure its only 35 seconds but with 17 repeats per master loop thats a lot of wasted time.So I was using a white pixel check for an object which if present indicates the wait is not needed, but it sometimes fails which causes probelms because the steps are very necessarywhen neededSo I tried adding a second check (check and balance sort of thing) if there is a white pixel there should not be a yellow pixel, if thats true skip the 35 seconds, if its false the first check failed proceed without skipping the 35 second wait and the steps that go with itBut I cant get it to work, I dont think it works the way I am trying to make it work.. so can someone help me sort this out please.. See the parts in red & green Thank you very muchNyxxEDIT: The problem I am having is the first if then links the second else/end if, and the second if then the first else/endif which makes the second pointlessI meant for the first if/then to link the first else/endif and the second if then to link the second else/endif...If that makes sense===========While 1If $X = 17 Then $X = 0PixelSearch(1380, 117, 1380, 117, 0XFFFFFF, 10)If @error then;****Check for a white pixel ;1 - No white pixel proceed;2 - Yes white see 2b;-- 2b - Check for yellow before skipping to 3PixelSearch(19, 1018, 19, 1018, 0XFFFF40, 10)If not@error then;****Check for a yellow pixel ;1 - Yes yellow pixel (white pixel check was wrong) proceed do not skip;2 - No yellow pixel (white pixel check was correct) skip to 3ElseEndIF;WaitSleep(4000) ;UDMouseClick("left",random (14, 16),random (1015, 1017),(1),(1))Sleep(500)Send("{ALTDOWN}u{ALTUP}");WaitSleep(35000);LOMouseClick("left",random(1381, 1383), random(116, 118),(1),(4))Sleep(500)MouseClick("left",random(1411, 1413), random(125, 127),(1),(4))Sleep(500);*****3 *********3ElseEndIF;BWTZMouseClick("right", $MouseClick[$X][0], $MouseClick[$X][1])Sleep(500)MouseClick("left", $MouseClick[$X][2], $MouseClick[$X][3]);Warp WaitSleep(90000)=======the rest of my script=======the rest of my script $X += 1WEnd Edited January 7, 2009 by nyxx24
andybiochem Posted January 7, 2009 Posted January 7, 2009 You're finding that PixelSearch doesn't always work because you've specified a tonal variance: PixelSearch(1380, 117, 1380, 117, 0XFFFFFF, 10) ...the '10' at the end allows the PixelSearch to make a match when a slightly off-white appears. Replace it with zero if you want EXACT white. If you meant for the '10' to be there then try putting the conditions together instead: expandcollapse popupWhile 1 If $X = 17 Then $X = 0 $WhiteTest = PixelSearch(1380, 117, 1380, 117, 0XFFFFFF, 10) $YellowTest = PixelSearch(19, 1018, 19, 1018, 0XFFFF40, 10) If Not (IsArray($WhiteTest) = 1 And IsArray($YellowTest) = 0) Then Sleep(4000) ;UD MouseClick("left",random (14, 16),random (1015, 1017),(1),(1)) Sleep(500) Send("{ALTDOWN}u{ALTUP}") ;Wait Sleep(35000) ;LO MouseClick("left",random(1381, 1383), random(116, 118),(1),(4)) Sleep(500) MouseClick("left",random(1411, 1413), random(125, 127),(1),(4)) Sleep(500) ;*****3 *********3 Else ;NOTE - it's pointless having an Else here unless there is something to go in it. EndIF EndIf ;BWTZ MouseClick("right", $MouseClick[$X][0], $MouseClick[$X][1]) Sleep(500) MouseClick("left", $MouseClick[$X][2], $MouseClick[$X][3]) ;Warp Wait Sleep(90000) =======the rest of my script =======the rest of my script $X += 1 WEnd Let us know if that works. - Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!
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