Jump to content

Pixelsearch with muliple outcomes?


Recommended Posts

Is it possible to do a pixelsearch for colors in an array. and then have a different out come for the different colors found?

ex: red is found, up key is pressed. blue is found down key is pressed.

as of right now i have a different pixelsearch function for every color and its too slow.

Link to comment
Share on other sites

I don't think this is possible. If you look at the help file, pixelsearch only returns the coordinates. Autoit doesn't support many color functions. There isn't a very high demand.

You could try using adlibenable. If that isn't enough, you could pick up the beta version and use adlibregister.

Link to comment
Share on other sites

You are probably doing a large while loop with a lot of stuff inside. You can split the loop into two parts if you use adlibenable. The beta version of autoit allows you to register multiple adlib loops. You just have to make sure you set the time parameter to a high enough value so you don't overload your computer.

EX:

While 1
      If IsArray(PixelSearch(0, 0, 50, 50, 0xFF0000)) Then;dofunction
      If IsArray(PixelSearch(0, 0, 50, 50, 0x00FF00)) Then;dofunction
      If IsArray(PixelSearch(0, 0, 50, 50, 0x000FF0)) Then;dofunction
      If IsArray(PixelSearch(0, 0, 50, 50, 0x0000FF)) Then;dofunction
WEnd

This could be changed to:

AdlibEnable("Adlib", 250)

While 1
      If IsArray(PixelSearch(0, 0, 50, 50, 0xFF0000)) Then;dofunction
      If IsArray(PixelSearch(0, 0, 50, 50, 0x00FF00)) Then;dofunction
WEnd

Func Adlib()
      If IsArray(PixelSearch(0, 0, 50, 50, 0x000FF0)) Then;dofunction
      If IsArray(PixelSearch(0, 0, 50, 50, 0x0000FF)) Then;dofunction
EndFunc

You can use adlibregister in the beta version using the same basic principles, just using more functions.

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...