Jump to content
Sign in to follow this  
nyxx24

Problem with 2 pixel searches

Recommended Posts

nyxx24

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 necessary

when needed

So 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 it

But 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 much

Nyxx

EDIT: 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 pointless

I 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 1

If $X = 17 Then $X = 0

PixelSearch(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 3

PixelSearch(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 3

Else

EndIF

;Wait

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

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

Edited by nyxx24

Share this post


Link to post
Share on other sites
andybiochem

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:

While 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!

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  

×