Sign in to follow this  
Followers 0
SwordHunter4Ever

Pixel search help please.

4 posts in this topic

Hey guys I understand the basics of pixel search.

You can tell it to search within this specified rectangle for a certain color and if there is or isn't that color do this or that. I however need a command that makes it do something if there is any color besides the color I specify in that rectangle. So lets say my color is pure white, and there is one dot of blue in there. I need the script to do something because that dot of blue is there. I don't know which color it will be that shows up however, say it be green, purple, pink, blue, orange, yellow or any other color. I just need it to do something if any color besides pure white shows up. Is there something that can do this?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You can have it scan to see if anything has changed. Give me a sec to check the help file because I'm not sure what I'm thinking is the right command.

I'll edit it in, in about 30 secs.

EDIT:

PixelChecksum 
--------------------------------------------------------------------------------

Generates a checksum for a region of pixels.


PixelChecksum ( left, top, right, bottom [, step [,hwnd]] )


 

Parameters

left left coordinate of rectangle. 
top top coordinate of rectangle. 
right right coordinate of rectangle. 
bottom bottom coordinate of rectangle. 
step [optional] Instead of checksumming each pixel use a value larger than 1 to skip pixels (for speed). E.g. A value of 2 will only check every other pixel. Default is 1. It is not recommended to use a step value greater than 1. 
hwnd  [optional] Window handle to be used. 

 

Return Value

Returns the checksum value of the region.

 

Remarks

A checksum only allows you to see if "something" has changed in a region - it does not tell you exactly what has changed.

Previous versions were extremely slow, however the function is now significantly faster. Using the step parameter is no longer recommended. The performance gain from using a larger step is not nearly as noticeable since the function is faster all around. Also, the larger the step, the less reliable the checksum becomes when used to detect small changes in the region.

Helpfile the command for examples.

Edited by Drew

Share this post


Link to post
Share on other sites

If $detectedColor <> $baselineColor Then
 doSomething()
Endif

func doSomething()
endfunc

<> means "not equal to", so the above code would mean "if my detected color is not equal to the baseline color, then do something, otherwise, do nothing."

Share this post


Link to post
Share on other sites

If $detectedColor <> $baselineColor Then
 doSomething()
Endif

func doSomething()
endfunc

<> means "not equal to", so the above code would mean "if my detected color is not equal to the baseline color, then do something, otherwise, do nothing."

Oh thats awesome!

I never knew there was a not equal to command in autoit, that would have saved me so much trouble in the past xD

I always was looking a =/= or something xD

Thanks a ton!

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