Jump to content

PixelSearch for 1 colour x 3 times


Recommended Posts

Hey guys.

I need to know how to count how many times when the colour the same is found 3 times and within a certain distance from each another (+50 pixels or so). Needs to work from whole screen resolution

So colour is 0xFF710C and when found colour 1 does a search by 50 pixels, then checks for 2nd using 50 pixel search from position 1. Searches again from 2nd position using 50 pixels search to get the 3 colour. Adds to the count to say found so many times....

Thanks.

Edited by Zer0Velocity
Link to comment
Share on other sites

sumthin like :

$found = 0

$xpos = 100

$color = 0xFF...

For $i = 1 to $xpos

$getcolor = pixelgetcolor($i...

if $getcolor = $color then

$found = $found+1

$xpos = $xpos+50

endif

if $found = 3 then exitloop

next

Msgbox(toomany fails...

i hope this helps

:alien: ~ Every Living Thing is a Code Snippet of World Application ~ :alien:

Link to comment
Share on other sites

I have got this but for some reason the count won't go up, any ideas? :)

HotKeySet("{NUMPADDOT}", "search")

HotKeySet("{ESC}", "quit")

Func search()

$xpos = 100

$color = 0xFF710C

$found = 0

For $i = 1 to $xpos

$getcolor = pixelgetcolor( $i , $xpos )

If $getcolor = $color then

Do

$found = $found + 1

$xpos = $xpos + 50

Until $found = 3 Then

Msgbox(0, "Count OK", $found)

EndIf

If $found < 3 Then ExitLoop

Next

Msgbox(0, "Count BAD", $found)

EndFunc

Func quit()

Exit

EndFunc

WinWaitClose("")

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