Jump to content
Sign in to follow this  
njp988

Question involving pixels

Recommended Posts

njp988

In this loop, I'm trying to get the mouse to click on a color that isnt white. In order to do this, I have the loop pick random coordinates inside a small rectangle. The problem is that it seems to just pick the first coordinate that it gets, and clicks on it.

$f = 0
While $f = 0

        $LowFL = 225                                                
        $HighFL = 250                                           
        $LowFR= 257                                             
        $HighFR = 286                                               
    
        $RandomNumber11 = Random($LowFL,$HighFL,1)               ;Creates Variable That is a random number between 2 variables 
        $RandomNumber12 = Random($LowFR,$HighFR,1)          ;Creates Variable That is a random number between 2 variables 
    

$MP = PixelGetColor( $RandomNumber11, $RandomNumber12);;;;;here's where the program tries to find the monster
If $MP <> 16777215 Then $f = 1;16777215 is the shade of white in the background. If the color isnt white, then f = 1 breaks this loop, and goes to the mouse click.
If $MP = 14078934 Then $f = 0;this is the shade of black used as a border, which doesnt count if you click on it so I've excluded that too.
If $MP = 16777215 Then $f = 0;the shade of white I dont want to click on. might be a little redundant
WEnd

mouseclick("`left", $RandomNumber11, $RandomNumber12)
Edited by njp988

Share this post


Link to post
Share on other sites
BrettF
njp988

Pixel search for a white pixel? Then Don't click there... :)

you mean something like this?

If $MP <> 16777215 Then $f = 1;16777215 is the shade of white in the background. If the color isnt white, then f = 1 breaks this loop, and goes to the mouse click.

Share this post


Link to post
Share on other sites
youknowwho4eva

Look up the _colorgetblue green and red functions. When I made my barcode reading program I used those. For mine it was either black or white. So I believe I used red. I said if its below so much red then its white, if its above so much its black.

Pushing the 24 hour bump limit aren't we? :)


Giggity

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  

×