Jump to content

Pixelsearch Help


Recommended Posts

Hi, i am working on a little project that requires me to search for a pixel color in a specified field.

So far i have managed to make it work on a preset location pixelsearch box, everything works flawlessly.

But for maximum versatility i want to make it so i can click on a point on my screen, then it will form a preset sized pixelsearchbox around the point i clicked at.

So like for example i would like to be able to press f10, then it asks me to click somewhere. Then it takes that location i clicked at and form a preset sized pixelsearch box around it.

Posted Image

The gray dot would be a point i clicked at on my screen.

The red square would be the preset sized pixelsearch box that gets made around it.

I hope i explained it well enough for someone to understand.

As always, any help on how to do this is greatly appreciated. :)

Edited by shadowbladex
Link to comment
Share on other sites

Hi shadowbladex,

Doing a search of your topic, it's been found many times with the search feature or is listed as a non-descriptive topic.

Please do a search before posting new thread topics.

And please use descriptive topics so that others that do use the search feature may also find what they are seeking.

(You'll also find that using descriptive topics, will get people in your thread that know how to answer your questions, those same people ignore non-descriptive topics).

Thanks.

Link to comment
Share on other sites

Hi shadowbladex,

Doing a search of your topic, it's been found many times with the search feature or is listed as a non-descriptive topic.

Please do a search before posting new thread topics.

And please use descriptive topics so that others that do use the search feature may also find what they are seeking.

(You'll also find that using descriptive topics, will get people in your thread that know how to answer your questions, those same people ignore non-descriptive topics).

Thanks.

Yes Mr. Bot, i have already searched and was not able to find what i was looking for. :)

Silly bot. >_<

Edited by shadowbladex
Link to comment
Share on other sites

Func test()
    While Not _IsPressed(01)
        Sleep(100)
    WEnd
    $pos=MouseGetPos()
    $ps=PixelSearch($pos[0]-$width/2,$pos[1]-$height/2,$pos[0]+$width/2,$pos[1]+$height/2,$yourcolor)
EndFunc

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Link to comment
Share on other sites

Func test()
    While Not _IsPressed(01)
        Sleep(100)
    WEnd
    $pos=MouseGetPos()
    $ps=PixelSearch($pos[0]-$width/2,$pos[1]-$height/2,$pos[0]+$width/2,$pos[1]+$height/2,$yourcolor)
EndFunc
Oh thats awesome thanks!

Could you explain a bit on how "$ps=PixelSearch($pos[0]-$width/2,$pos[1]-$height/2,$pos[0]+$width/2,$pos[1]+$height/2,$yourcolor)" works?

How big will this make the pixelsearch box? What numbers correspond with the size of the box?

Edited by shadowbladex
Link to comment
Share on other sites

$width is the width of the box and $height is the height of the box so if

$width=100 and

$height=100 then the box will be 100x100 pixels (50 pixels up,50 down,50 left,50 right)

if $width=40 and $height=80 the box will be 40x80 pixels (40 pixels up,40 down,20 left and 20 right)

cheers :)

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Link to comment
Share on other sites

$width is the width of the box and $height is the height of the box so if

$width=100 and

$height=100 then the box will be 100x100 pixels (50 pixels up,50 down,50 left,50 right)

if $width=40 and $height=80 the box will be 40x80 pixels (40 pixels up,40 down,20 left and 20 right)

cheers >_<

You are a legend. Thanks so much :)

Link to comment
Share on other sites

  • 1 month later...

Keep in mind that Pixel Search always searches the specified rectangle in a

1. left-to-right then

2. top-to-bottom

pattern until it finds a pixel matching the specified <colour> to within <shade-variation> tolerance.

That left to right, top to bottom hard coded limitation may not always yield the result you are looking for.

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