Sign in to follow this  
Followers 0
darklonerlv

pixelsearh and keypresses

7 posts in this topic

im trying to get this script to repeat itself, im still learning autoit and correct me if i am wrong i believe the @error flag gets stuck once this is detected its a random blinking color i want to find that will appear and disappear. is the Until not @error where my problem lies? How would i get this to repeat itself. after each detection of the correct color

Do
                $coord = PixelSearch( 588, 422, 599, 434, 16645626, 10 )
            Until  Not @error
        send("{UP}",1)

Share this post


Link to post
Share on other sites



when it locates it the first time, it stops sending the defined key like it the flag is stuck.

Share this post


Link to post
Share on other sites

fair enough ill post the entire code 6 times max is what im working with. first one works great then it stops

Do
                $coord = PixelSearch( 588, 422, 599, 434, 16645626, 10 )
            Until  Not @error
        send("{UP}")

    Do
                $coord = PixelSearch( 588, 422, 599, 434, 16645626, 10 )
            Until  Not @error
        send("{UP}",1)
         Do
                $coord = PixelSearch( 588, 422, 599, 434, 16645626, 10 )
            Until  Not @error
        send("{UP}",1)
        Do
                $coord = PixelSearch( 588, 422, 599, 434, 16645626, 10 )
            Until  Not @error
        send("{UP}",1)
         Do
                $coord = PixelSearch( 588, 422, 599, 434, 16645626, 10 )
            Until  Not @error
        send("{UP}",1)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Take a look at this:

;script starts
Do
    $coord = PixelSearch( 588, 422, 599, 434, 16645626, 10 )
Until  Not @error ;loop until color found
send("{UP}",1)
;scripts exits

Do you understand what I mean now? :blink:

So if you want it to repeat, stick it in a loop:

;script starts
While 1 ;makes for a good eternal loop
    Do
        Sleep(10)
        $coord = PixelSearch( 588, 422, 599, 434, 16645626, 10 )
    Until  Not @error ;loop until color found
    send("{UP}",1)
WEnd
;script never comes here

Edit: I hope you have a Sleep() in there, you don't want to suck up the whole CPU do you? (added sleep to example)

Edited by AdmiralAlkex

Share this post


Link to post
Share on other sites

lol yea i got ya now. now to add a stop function

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