Jump to content

Question involving pixels


njp988
 Share

Recommended Posts

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

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