Jump to content

pixel search


Go to solution Solved by nullschritt,

Recommended Posts

hi all

i have this code

while 1
    If PixelSearch(300,60,360,300,4558577) <> 0 Then left()
    If PixelSearch(40,60,100,300,4558577)<> 0 Then right()
    Sleep(1000)
WEnd

when it finds a pixel on a rectangle on the screen it do function left

when it finds the same  pixel on another rectangle on the screen it do function right

how can i make it when i finds the pixel on the two rectangles at the same time it do another function without doing right and left functions ?

maybe it should be 

while 1
    If PixelSearch(300,60,360,300,4558577) And PixelSearch(40,60,100,300,4558577) <> 0 Then third()
    If PixelSearch(300,60,360,300,4558577) <> 0 Then left()
    If PixelSearch(40,60,100,300,4558577)<> 0 Then right()
    Sleep(1000)
WEnd

any ideas ?

but i think that this code will do the third function when it found it on the 2 rectangles but it will still do right and eft 

Edited by Alexxander

Link to comment
Share on other sites

While 1
    If PixelSearch(300, 60, 360, 300, 4558577) And PixelSearch(40, 60, 100, 300, 4558577) <> 0 Then
        third()
    Else
        If PixelSearch(300, 60, 360, 300, 4558577) <> 0 Then left()
        If PixelSearch(40, 60, 100, 300, 4558577) <> 0 Then right()
    EndIf
    Sleep(1000)
WEnd

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

Monkey's are, like, natures humans.

Link to comment
Share on other sites

  • Solution

Try this

while 1 

Select

    case PixelSearch(300,60,360,300,4558577) <> 0 And PixelSearch(40,60,100,300,4558577) <> 0
            third()

    case PixelSearch(300,60,360,300,4558577) <> 0
            left()

    Case PixelSearch(40,60,100,300,4558577) <> 0
           right()

EndSelect

Sleep(1000) 

WEnd
Edited by nullschritt
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...