Sign in to follow this  
Followers 0
Alexxander

pixel search

3 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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

1 person likes this

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

#3 ·  Posted (edited)

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
1 person likes this

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  
Followers 0