Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
justmatty

Picking a random pixel of a specific colour

Recommended Posts

Hey, is there a way of grabbing all the co-ordinates of a specific colour and putting them in an array or something? I want to use these co-ordinates and then pick a random one so I can move my mouse to a random pixel each time.

Share this post


Link to post
Share on other sites
Hey, is there a way of grabbing all the co-ordinates of a specific colour and putting them in an array or something? I want to use these co-ordinates and then pick a random one so I can move my mouse to a random pixel each time.

 

Yes FindColorEx http://wiki.scar-divi.com/FindColorEx

 

 

var TPAc: TPointArray; // Points of all colors Ltpa: Integer;     // Amount of all colors found Prc: TPoint;       // Random color point assignmentbegin                // Color    left bound, top bound, right bound, bottom bound FindColorEx(TPAc, 16777215, 0, 0, 800, 600); Ltpa := Length(TPAc); if (Ltpa > 0) then   Prc := TPAc[Random(Ltpa)]; SetMousePos(Prc.X, Prc.Y);    end.

 

Share this post


Link to post
Share on other sites
Yes FindColorEx http://wiki.scar-divi.com/FindColorEx

 

 

var TPAc: TPointArray; // Points of all colors Ltpa: Integer;     // Amount of all colors found Prc: TPoint;       // Random color point assignmentbegin                // Color    left bound, top bound, right bound, bottom bound FindColorEx(TPAc, 16777215, 0, 0, 800, 600); Ltpa := Length(TPAc); if (Ltpa > 0) then   Prc := TPAc[Random(Ltpa)]; SetMousePos(Prc.X, Prc.Y);    end.

 

 

Thanks! Appreciated.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...