Jump to content
Sign in to follow this  
darklonerlv

pixelsearh and keypresses

Recommended Posts

darklonerlv

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
darklonerlv

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
darklonerlv

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
AdmiralAlkex

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
darklonerlv

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.