Is there a way to do something similar to:
But instead of an exact point, checking an area? Say a square?Code:colorvar := GetColor(671, 462); if (SimilarColors(colorvar, 16750060, 40)) then
Is there a way to do something similar to:
But instead of an exact point, checking an area? Say a square?Code:colorvar := GetColor(671, 462); if (SimilarColors(colorvar, 16750060, 40)) then
FindColor(x, y, col, x1, y1, x2, y2);
Originally Posted by irc
Could I use SimilarColors(colorvar, 16750060, 40) as the color parameter in FindColor? Also I'm a big confused.. I looked up this function in the guide, and I don't understand why is there an extra x,y? at the front? There's 2 sets of coords for the 2 points to make the box, but what are the first two for?..
Use FindColorTolerance to search for a colour with a tolerance.
lol
The first x and y are the coordinates your colour is found finally.
SCAR Code:Program New;
Var
x, y : Integer;
t : TBox;
p : TPoint;
Function BoxAround(Point : TPoint; w, h : Integer): TBox;
Begin
Result.x1 := (Point.x - w);
Result.y1 := (Point.y - h);
Result.x2 := (Point.x + w);
Result.y2 := (Point.y + h);
End;
Begin
p := Point(671, 472);
t := BoxAround(p, 20, 20); //A square 20x20
If FindColorTolerance(x, y, 16750060, t.x1, t.y1, t.x2, t.y2, 40) Then //Find the color inside the box, 40 tolerance. x and y are the coords it FINDS the color
WriteLn('Found colour at '+ IntToStr(x) +', '+ IntToStr(y) +'.')
Else
WriteLn('Failed to find colour.');
End.
Ce ne sont que des gueux
There are currently 1 users browsing this thread. (0 members and 1 guests)