Sign in to follow this  
Followers 0
bf2forlife

randomizing mouseclick

2 posts in this topic

#1 ·  Posted (edited)

$coord = pixelsearch(0, 0, @DesktopWidth, @DesktopHeight,0x817F77)
Mouseclick("left", $coord[0], $coord[1])

So how i could click in random place of that color?

Edited by bf2forlife

Share this post


Link to post
Share on other sites



$coord = pixelsearch(0, 0, @DesktopWidth, @DesktopHeight,0x817F77)
Mouseclick("left", $coord[0], $coord[1])

So how i could click in random place of that color?

To do so first of all you need to build an array holding the coordinates of ALL occurrences of pixels of that given shade.

As pixelsearch always returns jus the 1st matching pixel's coords, you could break down the screen into single-pixel-lines. Then search these for the 1st occurrence, after that start searching the same line from x+1 to EOL.

Then use something like Random(1,$MyPixelArr[0],1) to pick out a random one.

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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