lordsaturn
05-07-2007, 12:45 AM
I get this error while trying to run any script.
Line 309: [Error] (5589:11): Unknown identifier 'FindColorCircleD' in script C:\Program Files\SCAR 2.03\includes\srl\srl\core\Color.scar
I looked in the Color.scar file and nothing seemed to be wrong...here it is anyways.
//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- » ColorFinding Routines --//
//-----------------------------------------------------------------//
// » function FindColorRightTol(var cx,cy: Integer; dacolor,ax1,ay1,ax2,ay2,tol: Integer): | by RSN
// » function FindMMColor(color:integer):boolean; | by Stupid3ooo
// » function FindMMColorTol(color,tol:integer):boolean; | by Stupid3ooo
// » function FindMSColor(color:integer):boolean; | by Stupid3ooo
// » function FindMSColorTol(color,tol:integer):boolean; | by Stupid3ooo
// » function FindColorEllipse(var x, y: integer; Color, Tol, X1, Y1, X2, Y2: integer): boolean; | by BenLand100
// » function FindColorsEllipse(var Points: TPointArray; Color, Tol, X1, Y1, X2, Y2: integer): boolean; | by BenLand100
// » function FindColorAbstract(var x,y: integer; Color, Tol, x1,y1,x2,y2,x3,y3,x4,y4: integer): boolean; | by BenLand100
// » function FindColorsAbstract(var Points: TPointArray; Color, Tol, x1,y1,x2,y2,x3,y3,x4,y4: integer): boolean; | by BenLand100
// » procedure ClickRandomlyOnColour(Colour, x, y, xa, ya : Integer; Left : Boolean); // * By Spky
// » function FindColorCircle(var x, y: Integer; color, radius, MidPointx, MidPointy: Integer): Boolean; | by Freddy1990
// » function FindColorCircleTolerance(var x, y: Integer; color, radius, MidPointx, MidPointy, tolerance: Integer): Boolean; | by Freddy1990
// » function FindColorSkipBox(var x, y: Integer; color, x1, y1, x2, y2: Integer; box: TBox): Boolean; | by Freddy1990
// » function FindColorSkipBoxTolerance(var x, y: Integer; color, x1, y1, x2, y2, tolerance: Integer; box: TBox): Boolean; | by Freddy1990
// » function FindColorSkipBoxArray(var x, y: Integer; color, x1, y1, x2, y2: Integer; box: TBoxArray): Boolean; | by Freddy1990
// » function FindColorSkipBoxArrayTolerance(var x, y: Integer; color, x1, y1, x2, y2, tolerance: Integer; box: TBoxArray): Boolean; | by Freddy1990
// » function ScanMMColorExact(var x, y: Integer; color: Integer): Boolean; | by Freddy1990
// » function ScanMMColorTolerance(var x, y: Integer; color, tolerance: Integer): Boolean; | by Freddy1990
// » procedure ClickExactMMColor(color: Integer); | by Freddy1990
// » procedure ClickExactMMColorTol(color, tolerance: Integer); | by Freddy1990
// » function ScanMMAreaColorExact(var x, y: Integer; x1, y1, x2, y2, color: Integer): Boolean; | by Freddy1990
// » function ScanMMAreaColorExactTolerance(var x, y: Integer; x1, y1, x2, y2, color, tolerance: Integer): Boolean; | by Freddy1990
{************************************************* ******************************
function FindColorRightTol(var cx, cy: Integer; dacolor, ax1, ay1, ax2, ay2, tol: Integer): Boolean;
By: RsN
Description: Same as FindColorTolerance but searches from right
************************************************** *****************************}
function FindColorRightTol(var cx, cy: Integer; dacolor, ax1, ay1, ax2, ay2,
tol: Integer): Boolean;
var
a, b, c, d: Integer;
x, y: Integer;
begin
a := ax2 - 1;
b := ay1;
c := ax2;
d := ay2;
repeat
Result := FindColorTolerance(x, y, dacolor, a, b, c, d, tol);
a := a - 1;
c := c - 1;
until (Result) or (a <= ax1);
if (Result) then
begin
cx := x;
cy := y;
end;
end;
{************************************************* ******************************
function FindMMColor(var x, y: Integer; color: Integer): Boolean;
By: Stupid3ooo
Description: Finds color on minimap
************************************************** *****************************}
function FindMMColor(var x, y: Integer; color: Integer): Boolean;
begin
Result := FindColor(x, y, color, MMX1, MMY1, MMX2, MMY2);
end;
{************************************************* ******************************
function FindMMColorTol(var x, y: Integer; color, tol: Integer): Boolean;
By: Stupid3ooo
Description: Finds color on Minimap with tolerance
************************************************** *****************************}
function FindMMColorTol(var x, y: Integer; color, tol: Integer): Boolean;
begin
Result := FindColorTolerance(x, y, color, MMX1, MMY1, MMX2, MMY2, tol);
end;
{************************************************* ******************************
function FindMSColor(var x, y: Integer; color: Integer): Boolean;
By: Stupid3ooo
Description: Finds color on MainScreen.
************************************************** *****************************}
function FindMSColor(var x, y: Integer; color: Integer): Boolean;
begin
Result := FindColor(x, y, color, MMX1, MMY1, MMX2, MMY2);
end;
{************************************************* ******************************
function FindMSColorTol(var x, y: Integer; color, tol: Integer): Boolean;
By: Stupid3ooo
Description: Finds color on Main Screen with tolerance.
************************************************** *****************************}
function FindMSColorTol(var x, y: Integer; color, tol: Integer): Boolean;
begin
Result := FindColorTolerance(x, y, color, MMX1, MMY1, MMX2, MMY2, tol);
end;
{************************************************* ******************************
function FindColorEllipse(var x, y: Integer; Color, Tol, X1, Y1, X2, Y2: Integer): Boolean;
By: BenLand100
Description: Searches only in the given ellipse for a color with tol, returns true if found and position in x, y
Set Ellips Bounds according to the diagram:
y1
+----------+
| |
| Ellipse |
x1 | Bounds | x2
| |
+----------+
y2
************************************************** *****************************}
function FindColorEllipse(var x, y: Integer; Color, tol, X1, Y1, X2, Y2:
Integer): Boolean;
var
Temp: TCanvas;
Cx, Cy, H, W, ScreenBmp, TempBmp, Handle: Integer;
begin
W := Max(X1, X2) - Min(X1, X2);
H := Max(Y1, Y2) - Min(Y1, Y2);
Handle := GetClientWindowHandle;
TempBmp := BitmapFromString(W, H, '');
Temp := GetBitmapCanvas(TempBmp);
ScreenBmp := BitmapFromString(W, H, '');
FastDrawClear(TempBmp, -1);
CopyClientToBitmap(ScreenBmp, X1, Y1, X2, Y2);
CopyCanvas(GetBitmapCanvas(TempBmp), Temp, 0, 0, W, H, 0, 0, W, H);
Temp.Ellipse(0, 0, W, H);
CopyCanvas(Temp, GetBitmapCanvas(TempBmp), 0, 0, W, H, 0, 0, W, H);
SetTransparentColor(TempBmp, 16777215);
FastDrawTransparent(0, 0, TempBmp, ScreenBmp);
SetTargetBitmap(ScreenBmp);
x := -1;
y := -1;
Cx := W div 2;
Cy := H div 2;
if FindColorSpiralTolerance(Cx, Cy, Color, 0, 0, W, H, tol) then
begin
x := Cx;
y := Cy;
Result := True;
end;
SetClientWindowHandle(Handle);
FreeBitmap(TempBmp);
FreeBitmap(ScreenBmp);
end;
{************************************************* ******************************
function FindColorsEllipse(var Points: TPointArray; Color, Tol, X1, Y1, X2, Y2: Integer): Boolean;
By: BenLand100
Description: Searches only in the given ellipse for every color with tol, returns true if found and the points in Points
Set Ellips Bounds according to the diagram:
y1
+----------+
| |
| Ellipse |
x1 | Bounds | x2
| |
+----------+
y2
************************************************** *****************************}
function FindColorsEllipse(var Points: TPointArray; Color, tol, X1, Y1, X2, Y2:
Integer): Boolean;
var
Temp: TCanvas;
PtTemp: TPointArray;
H, W, ScreenBmp, TempBmp, Handle: Integer;
begin
W := Max(X1, X2) - Min(X1, X2);
H := Max(Y1, Y2) - Min(Y1, Y2);
Handle := GetClientWindowHandle;
TempBmp := BitmapFromString(W, H, '');
Temp := GetBitmapCanvas(TempBmp);
ScreenBmp := BitmapFromString(W, H, '');
FastDrawClear(TempBmp, -1);
CopyCanvas(GetClientCanvas, GetBitmapCanvas(ScreenBmp), X1, Y1, X2, Y2, 0, 0,
W, H);
CopyCanvas(GetBitmapCanvas(TempBmp), Temp, 0, 0, W, H, 0, 0, W, H);
Temp.Ellipse(0, 0, W, H);
CopyCanvas(Temp, GetBitmapCanvas(TempBmp), 0, 0, W, H, 0, 0, W, H);
SetTransparentColor(TempBmp, 16777215);
FastDrawTransparent(0, 0, TempBmp, ScreenBmp);
SetTargetBitmap(ScreenBmp);
FindColorsSpiralTolerance(W / 2, H / 2, PtTemp, Color, 0, 0, W, H, tol);
if GetArrayLength(PtTemp) > 0 then
begin
Points := PtTemp;
Result := True;
end;
SetClientWindowHandle(Handle);
FreeBitmap(TempBmp);
FreeBitmap(ScreenBmp);
end;
{************************************************* ******************************
function FindColorAbstract(var x, y: Integer; Color, Tol, x1, y1, x2, y2, x3, y3, x4, y4: Integer): Boolean;
By: BenLand100
Description: Searches in an abstract box (see Math.scar) for a color and tolerance and the first one found in x, y
************************************************** *****************************}
function FindColorAbstract(var x, y: Integer; Color, tol, x1, y1, x2, y2, x3,
y3, x4, y4: Integer): Boolean;
var
found: Boolean;
Pt, CX, CY, UY, dy, rx, LX: Integer;
Points: TPointArray;
begin
UY := Min(y1, y2);
dy := Max(y3, y4);
LX := Min(x1, x4);
rx := Max(x2, x3);
FindColorsSpiralTolerance(((LX + rx) / 2), ((UY + dy) / 2), Points, Color, LX,
UY, rx, dy, tol);
for pt := 0 to GetArrayLength(points) - 1 do
if InAbstractBox(x1, y1, x2, y2, x3, y3, x4, y4, Points[pt].x, Points[pt].y) then
begin
found := True;
CX := Points[pt].x;
CY := Points[pt].y
Break;
end;
x := -1
y := -1
if found then
begin
x := CX
y := CY
Result := True
end;
end;
{************************************************* ******************************
function FindColorsAbstract(var Points: TPointArray; Color, Tol, x1, y1, x2, y2, x3, y3, x4, y4: Integer): Boolean;
By: BenLand100
Description: Searches in an abstract box (see Math.scar) for a color and tolerance and puts every instance of it in Points
************************************************** *****************************}
function FindColorsAbstract(var Points: TPointArray; Color, tol, x1, y1, x2, y2,
x3, y3, x4, y4: Integer): Boolean;
var
Pt, TempPt, UY, dy, rx, LX: Integer;
FPoints, Temp: TPointArray;
begin
UY := Min(y1, y2);
dy := Max(y3, y4);
LX := Min(x1, x4);
rx := Max(x2, x3);
FindColorsSpiralTolerance(((LX + rx) / 2), ((UY + dy) / 2), FPoints, Color,
LX, UY, rx, dy, tol);
for pt := 0 to GetArrayLength(FPoints) - 1 do
begin
WriteLn(IntToStr(FPoints[pt].x) + ', ' + IntToStr(FPoints[pt].y));
if InAbstractBox(x1, y1, x2, y2, x3, y3, x4, y4, FPoints[Pt].x,
FPoints[Pt].y) then
begin
Result := True;
SetArrayLength(Temp, GetArrayLength(Temp) - 1);
TempPt := GetArrayLength(Temp) - 1;
Temp[TempPt].x := FPoints[Pt].x;
Temp[TempPt].y := FPoints[Pt].y;
end;
end;
Points := Temp;
end;
{************************************************* ******************************
procedure ClickRandomlyOnColour(Colour, x, y, xa, ya: Integer; Left: Boolean);
By: Spky
Description: Clicks randomly on the specified colour in box "x, y, xa, ya".
************************************************** *****************************}
procedure ClickRandomlyOnColour(Colour, x, y, xa, ya: Integer; Left: Boolean);
var
Ix, Iy, I: Integer;
Coords: array of TPoint;
begin
for Iy := y to ya do
for Ix := x to xa do
if (GetColor(Ix, Iy) = Colour) then
begin
SetArrayLength(Coords, GetArrayLength(Coords) + 1)
Coords[GetArrayLength(Coords) - 1].x := Ix;
Coords[GetArrayLength(Coords) - 1].y := Iy;
end;
I := 0 + Random(GetArrayLength(Coords));
if (I > 0) then
case Left of
True: Mouse(Coords[I].x, Coords[I].y, 0, 0, True);
False: Mouse(Coords[I].x, Coords[I].y, 0, 0, True);
end;
end;
{************************************************* ******************************
function FindColorCircle(var x, y: Integer; color, radius, MidPointx, MidPointy: Integer): Boolean;
By: Freddy1990
Description: Searches for a color within a circle.
************************************************** *****************************}
function FindColorCircle(var x, y: Integer; color, radius, MidPointx, MidPointy:
Integer): Boolean;
begin
Result := FindColorCircleD(x, y, color, radius, MidPointx, MidPointy, 0);
end;
{************************************************* ******************************
function FindColorCircleTolerance(var x, y: Integer; color, radius, MidPointx, MidPointy, tolerance: Integer): Boolean;
By: Freddy1990
Description: Searches for a color with a tolerance within a circle.
************************************************** *****************************}
function FindColorCircleTolerance(var x, y: Integer; color, radius, MidPointx,
MidPointy, tolerance: Integer): Boolean;
begin
Result := FindColorCircleD(x, y, color, radius, MidPointx, MidPointy,
tolerance);
end;
{************************************************* ******************************
function FindColorSkipBox(var x, y: Integer; color, x1, y1, x2, y2: Integer; box: TBox): Boolean;
By: Freddy1990
Description: Searches for a color in a square while skipping a square.
************************************************** *****************************}
function FindColorSkipBox(var x, y: Integer; color, x1, y1, x2, y2: Integer;
box: TBox): Boolean;
var
a, b: TPointArray;
begin
SetArrayLength(a, 1);
SetArrayLength(b, 1);
a[0] := cPoint2(box, 1);
b[0] := cPoint2(box, 2);
Result := FindColorSkipBoxD(x, y, color, x1, y1, x2, y2, 0, a, b);
end;
{************************************************* ******************************
function FindColorSkipBoxTolerance(var x, y: Integer; color, x1, y1, x2, y2, tolerance: Integer; box: TBox): Boolean;
By: Freddy1990
Description: Searches for a color in a square while skipping a square with a tolerance.
************************************************** *****************************}
function FindColorSkipBoxTolerance(var x, y: Integer; color, x1, y1, x2, y2,
tolerance: Integer; box: TBox): Boolean;
var
a, b: TPointArray;
begin
SetArrayLength(a, 1);
SetArrayLength(b, 1);
a[0] := cPoint2(box, 1);
b[0] := cPoint2(box, 2);
Result := FindColorSkipBoxD(x, y, color, x1, y1, x2, y2, tolerance, a, b);
end;
{************************************************* ******************************
function FindColorSkipBoxArray(var x, y: Integer; color, x1, y1, x2, y2: Integer; box: TBoxArray): Boolean;
By: Freddy1990
Description: Searches for a color in a square while skipping multiple squares.
************************************************** *****************************}
function FindColorSkipBoxArray(var x, y: Integer; color, x1, y1, x2, y2:
Integer; box: TBoxArray): Boolean;
var
a, b: TPointArray;
begin
a := cPointArray2(box, 1);
b := cPointArray2(box, 2);
Result := FindColorSkipBoxD(x, y, color, x1, y1, x2, y2, 0, a, b);
end;
{************************************************* ******************************
function FindColorSkipBoxArrayTolerance(var x, y: Integer; color, x1, y1, x2, y2, tolerance: Integer; box: TBoxArray): Boolean;
By: Freddy1990
Description: Searches for a color in a square while skipping multiple squares.
************************************************** *****************************}
function FindColorSkipBoxArrayTolerance(var x, y: Integer; color, x1, y1, x2,
y2, tolerance: Integer; box: TBoxArray): Boolean;
var
a, b: TPointArray;
begin
a := cPointArray2(box, 1);
b := cPointArray2(box, 2);
Result := FindColorSkipBoxD(x, y, color, x1, y1, x2, y2, tolerance, a, b);
end;
{************************************************* ******************************
function ScanMMColorExact(var x, y: Integer; color: Integer): Boolean;
By: Freddy1990
Description: Finds a color on the minimap. (minimap being 100% correct)
************************************************** *****************************}
function ScanMMColorExact(var x, y: Integer; color: Integer): Boolean;
begin
Result := ScanExactMinimapD(x, y, color, 0);
end;
{************************************************* ******************************
function ScanMMColorExactTolerance(var x, y: Integer; color, tolerance: Integer): Boolean;
By: Freddy1990
Description: Finds a color with a tolerance on the minimap. (minimap being 100% correct)
************************************************** *****************************}
function ScanMMColorExactTolerance(var x, y: Integer; color, tolerance:
Integer): Boolean;
begin
Result := ScanExactMinimapD(x, y, color, tolerance);
end;
{************************************************* ******************************
procedure ClickExactMMColor(color: Integer);
By: Freddy1990
Description: Clicks a color on the EXACT minimap
************************************************** *****************************}
procedure ClickExactMMColor(color: Integer);
var
x, y: Integer;
begin
if (ScanMMColorExact(x, y, color)) then
Mouse(x, y, 0, 0, True);
end;
{************************************************* ******************************
procedure ClickExactMMColorTol(color, tolerance: Integer);
By: Freddy1990
Description: Clicks a color with a tolerance on the EXACT Minimap.
************************************************** *****************************}
procedure ClickExactMMColorTol(color, tolerance: Integer);
var
x, y: Integer;
begin
if (ScanMMColorExactTolerance(x, y, color, tolerance)) then
Mouse(x, y, 0, 0, True);
end;
{************************************************* ******************************
function ScanMMAreaColorExact(var x, y: Integer; x1, y1, x2, y2, color: Integer): Boolean;
By: Freddy1990
Description: Finds a color in the specified rectangle on the minimap. (minimap being 100% correct)
************************************************** *****************************}
function ScanMMAreaColorExact(var x, y: Integer; x1, y1, x2, y2, color:
Integer): Boolean;
begin
Result := ScanExactMMAreaD(x, y, x1, y1, x2, y2, color, 0);
end;
{************************************************* ******************************
function ScanMMAreaColorExactTolerance(var x, y: Integer; x1, y1, x2, y2, color, tolerance: Integer): Boolean;
By: Freddy1990
Description: Finds a color in the specified rectangle with a tolerance on the minimap. (minimap being 100% correct)
************************************************** *****************************}
function ScanMMAreaColorExactTolerance(var x, y: Integer; x1, y1, x2, y2, color,
tolerance: Integer): Boolean;
begin
Result := ScanExactMMAreaD(x, y, x1, y1, x2, y2, color, tolerance);
end;
Line 309: [Error] (5589:11): Unknown identifier 'FindColorCircleD' in script C:\Program Files\SCAR 2.03\includes\srl\srl\core\Color.scar
I looked in the Color.scar file and nothing seemed to be wrong...here it is anyways.
//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- » ColorFinding Routines --//
//-----------------------------------------------------------------//
// » function FindColorRightTol(var cx,cy: Integer; dacolor,ax1,ay1,ax2,ay2,tol: Integer): | by RSN
// » function FindMMColor(color:integer):boolean; | by Stupid3ooo
// » function FindMMColorTol(color,tol:integer):boolean; | by Stupid3ooo
// » function FindMSColor(color:integer):boolean; | by Stupid3ooo
// » function FindMSColorTol(color,tol:integer):boolean; | by Stupid3ooo
// » function FindColorEllipse(var x, y: integer; Color, Tol, X1, Y1, X2, Y2: integer): boolean; | by BenLand100
// » function FindColorsEllipse(var Points: TPointArray; Color, Tol, X1, Y1, X2, Y2: integer): boolean; | by BenLand100
// » function FindColorAbstract(var x,y: integer; Color, Tol, x1,y1,x2,y2,x3,y3,x4,y4: integer): boolean; | by BenLand100
// » function FindColorsAbstract(var Points: TPointArray; Color, Tol, x1,y1,x2,y2,x3,y3,x4,y4: integer): boolean; | by BenLand100
// » procedure ClickRandomlyOnColour(Colour, x, y, xa, ya : Integer; Left : Boolean); // * By Spky
// » function FindColorCircle(var x, y: Integer; color, radius, MidPointx, MidPointy: Integer): Boolean; | by Freddy1990
// » function FindColorCircleTolerance(var x, y: Integer; color, radius, MidPointx, MidPointy, tolerance: Integer): Boolean; | by Freddy1990
// » function FindColorSkipBox(var x, y: Integer; color, x1, y1, x2, y2: Integer; box: TBox): Boolean; | by Freddy1990
// » function FindColorSkipBoxTolerance(var x, y: Integer; color, x1, y1, x2, y2, tolerance: Integer; box: TBox): Boolean; | by Freddy1990
// » function FindColorSkipBoxArray(var x, y: Integer; color, x1, y1, x2, y2: Integer; box: TBoxArray): Boolean; | by Freddy1990
// » function FindColorSkipBoxArrayTolerance(var x, y: Integer; color, x1, y1, x2, y2, tolerance: Integer; box: TBoxArray): Boolean; | by Freddy1990
// » function ScanMMColorExact(var x, y: Integer; color: Integer): Boolean; | by Freddy1990
// » function ScanMMColorTolerance(var x, y: Integer; color, tolerance: Integer): Boolean; | by Freddy1990
// » procedure ClickExactMMColor(color: Integer); | by Freddy1990
// » procedure ClickExactMMColorTol(color, tolerance: Integer); | by Freddy1990
// » function ScanMMAreaColorExact(var x, y: Integer; x1, y1, x2, y2, color: Integer): Boolean; | by Freddy1990
// » function ScanMMAreaColorExactTolerance(var x, y: Integer; x1, y1, x2, y2, color, tolerance: Integer): Boolean; | by Freddy1990
{************************************************* ******************************
function FindColorRightTol(var cx, cy: Integer; dacolor, ax1, ay1, ax2, ay2, tol: Integer): Boolean;
By: RsN
Description: Same as FindColorTolerance but searches from right
************************************************** *****************************}
function FindColorRightTol(var cx, cy: Integer; dacolor, ax1, ay1, ax2, ay2,
tol: Integer): Boolean;
var
a, b, c, d: Integer;
x, y: Integer;
begin
a := ax2 - 1;
b := ay1;
c := ax2;
d := ay2;
repeat
Result := FindColorTolerance(x, y, dacolor, a, b, c, d, tol);
a := a - 1;
c := c - 1;
until (Result) or (a <= ax1);
if (Result) then
begin
cx := x;
cy := y;
end;
end;
{************************************************* ******************************
function FindMMColor(var x, y: Integer; color: Integer): Boolean;
By: Stupid3ooo
Description: Finds color on minimap
************************************************** *****************************}
function FindMMColor(var x, y: Integer; color: Integer): Boolean;
begin
Result := FindColor(x, y, color, MMX1, MMY1, MMX2, MMY2);
end;
{************************************************* ******************************
function FindMMColorTol(var x, y: Integer; color, tol: Integer): Boolean;
By: Stupid3ooo
Description: Finds color on Minimap with tolerance
************************************************** *****************************}
function FindMMColorTol(var x, y: Integer; color, tol: Integer): Boolean;
begin
Result := FindColorTolerance(x, y, color, MMX1, MMY1, MMX2, MMY2, tol);
end;
{************************************************* ******************************
function FindMSColor(var x, y: Integer; color: Integer): Boolean;
By: Stupid3ooo
Description: Finds color on MainScreen.
************************************************** *****************************}
function FindMSColor(var x, y: Integer; color: Integer): Boolean;
begin
Result := FindColor(x, y, color, MMX1, MMY1, MMX2, MMY2);
end;
{************************************************* ******************************
function FindMSColorTol(var x, y: Integer; color, tol: Integer): Boolean;
By: Stupid3ooo
Description: Finds color on Main Screen with tolerance.
************************************************** *****************************}
function FindMSColorTol(var x, y: Integer; color, tol: Integer): Boolean;
begin
Result := FindColorTolerance(x, y, color, MMX1, MMY1, MMX2, MMY2, tol);
end;
{************************************************* ******************************
function FindColorEllipse(var x, y: Integer; Color, Tol, X1, Y1, X2, Y2: Integer): Boolean;
By: BenLand100
Description: Searches only in the given ellipse for a color with tol, returns true if found and position in x, y
Set Ellips Bounds according to the diagram:
y1
+----------+
| |
| Ellipse |
x1 | Bounds | x2
| |
+----------+
y2
************************************************** *****************************}
function FindColorEllipse(var x, y: Integer; Color, tol, X1, Y1, X2, Y2:
Integer): Boolean;
var
Temp: TCanvas;
Cx, Cy, H, W, ScreenBmp, TempBmp, Handle: Integer;
begin
W := Max(X1, X2) - Min(X1, X2);
H := Max(Y1, Y2) - Min(Y1, Y2);
Handle := GetClientWindowHandle;
TempBmp := BitmapFromString(W, H, '');
Temp := GetBitmapCanvas(TempBmp);
ScreenBmp := BitmapFromString(W, H, '');
FastDrawClear(TempBmp, -1);
CopyClientToBitmap(ScreenBmp, X1, Y1, X2, Y2);
CopyCanvas(GetBitmapCanvas(TempBmp), Temp, 0, 0, W, H, 0, 0, W, H);
Temp.Ellipse(0, 0, W, H);
CopyCanvas(Temp, GetBitmapCanvas(TempBmp), 0, 0, W, H, 0, 0, W, H);
SetTransparentColor(TempBmp, 16777215);
FastDrawTransparent(0, 0, TempBmp, ScreenBmp);
SetTargetBitmap(ScreenBmp);
x := -1;
y := -1;
Cx := W div 2;
Cy := H div 2;
if FindColorSpiralTolerance(Cx, Cy, Color, 0, 0, W, H, tol) then
begin
x := Cx;
y := Cy;
Result := True;
end;
SetClientWindowHandle(Handle);
FreeBitmap(TempBmp);
FreeBitmap(ScreenBmp);
end;
{************************************************* ******************************
function FindColorsEllipse(var Points: TPointArray; Color, Tol, X1, Y1, X2, Y2: Integer): Boolean;
By: BenLand100
Description: Searches only in the given ellipse for every color with tol, returns true if found and the points in Points
Set Ellips Bounds according to the diagram:
y1
+----------+
| |
| Ellipse |
x1 | Bounds | x2
| |
+----------+
y2
************************************************** *****************************}
function FindColorsEllipse(var Points: TPointArray; Color, tol, X1, Y1, X2, Y2:
Integer): Boolean;
var
Temp: TCanvas;
PtTemp: TPointArray;
H, W, ScreenBmp, TempBmp, Handle: Integer;
begin
W := Max(X1, X2) - Min(X1, X2);
H := Max(Y1, Y2) - Min(Y1, Y2);
Handle := GetClientWindowHandle;
TempBmp := BitmapFromString(W, H, '');
Temp := GetBitmapCanvas(TempBmp);
ScreenBmp := BitmapFromString(W, H, '');
FastDrawClear(TempBmp, -1);
CopyCanvas(GetClientCanvas, GetBitmapCanvas(ScreenBmp), X1, Y1, X2, Y2, 0, 0,
W, H);
CopyCanvas(GetBitmapCanvas(TempBmp), Temp, 0, 0, W, H, 0, 0, W, H);
Temp.Ellipse(0, 0, W, H);
CopyCanvas(Temp, GetBitmapCanvas(TempBmp), 0, 0, W, H, 0, 0, W, H);
SetTransparentColor(TempBmp, 16777215);
FastDrawTransparent(0, 0, TempBmp, ScreenBmp);
SetTargetBitmap(ScreenBmp);
FindColorsSpiralTolerance(W / 2, H / 2, PtTemp, Color, 0, 0, W, H, tol);
if GetArrayLength(PtTemp) > 0 then
begin
Points := PtTemp;
Result := True;
end;
SetClientWindowHandle(Handle);
FreeBitmap(TempBmp);
FreeBitmap(ScreenBmp);
end;
{************************************************* ******************************
function FindColorAbstract(var x, y: Integer; Color, Tol, x1, y1, x2, y2, x3, y3, x4, y4: Integer): Boolean;
By: BenLand100
Description: Searches in an abstract box (see Math.scar) for a color and tolerance and the first one found in x, y
************************************************** *****************************}
function FindColorAbstract(var x, y: Integer; Color, tol, x1, y1, x2, y2, x3,
y3, x4, y4: Integer): Boolean;
var
found: Boolean;
Pt, CX, CY, UY, dy, rx, LX: Integer;
Points: TPointArray;
begin
UY := Min(y1, y2);
dy := Max(y3, y4);
LX := Min(x1, x4);
rx := Max(x2, x3);
FindColorsSpiralTolerance(((LX + rx) / 2), ((UY + dy) / 2), Points, Color, LX,
UY, rx, dy, tol);
for pt := 0 to GetArrayLength(points) - 1 do
if InAbstractBox(x1, y1, x2, y2, x3, y3, x4, y4, Points[pt].x, Points[pt].y) then
begin
found := True;
CX := Points[pt].x;
CY := Points[pt].y
Break;
end;
x := -1
y := -1
if found then
begin
x := CX
y := CY
Result := True
end;
end;
{************************************************* ******************************
function FindColorsAbstract(var Points: TPointArray; Color, Tol, x1, y1, x2, y2, x3, y3, x4, y4: Integer): Boolean;
By: BenLand100
Description: Searches in an abstract box (see Math.scar) for a color and tolerance and puts every instance of it in Points
************************************************** *****************************}
function FindColorsAbstract(var Points: TPointArray; Color, tol, x1, y1, x2, y2,
x3, y3, x4, y4: Integer): Boolean;
var
Pt, TempPt, UY, dy, rx, LX: Integer;
FPoints, Temp: TPointArray;
begin
UY := Min(y1, y2);
dy := Max(y3, y4);
LX := Min(x1, x4);
rx := Max(x2, x3);
FindColorsSpiralTolerance(((LX + rx) / 2), ((UY + dy) / 2), FPoints, Color,
LX, UY, rx, dy, tol);
for pt := 0 to GetArrayLength(FPoints) - 1 do
begin
WriteLn(IntToStr(FPoints[pt].x) + ', ' + IntToStr(FPoints[pt].y));
if InAbstractBox(x1, y1, x2, y2, x3, y3, x4, y4, FPoints[Pt].x,
FPoints[Pt].y) then
begin
Result := True;
SetArrayLength(Temp, GetArrayLength(Temp) - 1);
TempPt := GetArrayLength(Temp) - 1;
Temp[TempPt].x := FPoints[Pt].x;
Temp[TempPt].y := FPoints[Pt].y;
end;
end;
Points := Temp;
end;
{************************************************* ******************************
procedure ClickRandomlyOnColour(Colour, x, y, xa, ya: Integer; Left: Boolean);
By: Spky
Description: Clicks randomly on the specified colour in box "x, y, xa, ya".
************************************************** *****************************}
procedure ClickRandomlyOnColour(Colour, x, y, xa, ya: Integer; Left: Boolean);
var
Ix, Iy, I: Integer;
Coords: array of TPoint;
begin
for Iy := y to ya do
for Ix := x to xa do
if (GetColor(Ix, Iy) = Colour) then
begin
SetArrayLength(Coords, GetArrayLength(Coords) + 1)
Coords[GetArrayLength(Coords) - 1].x := Ix;
Coords[GetArrayLength(Coords) - 1].y := Iy;
end;
I := 0 + Random(GetArrayLength(Coords));
if (I > 0) then
case Left of
True: Mouse(Coords[I].x, Coords[I].y, 0, 0, True);
False: Mouse(Coords[I].x, Coords[I].y, 0, 0, True);
end;
end;
{************************************************* ******************************
function FindColorCircle(var x, y: Integer; color, radius, MidPointx, MidPointy: Integer): Boolean;
By: Freddy1990
Description: Searches for a color within a circle.
************************************************** *****************************}
function FindColorCircle(var x, y: Integer; color, radius, MidPointx, MidPointy:
Integer): Boolean;
begin
Result := FindColorCircleD(x, y, color, radius, MidPointx, MidPointy, 0);
end;
{************************************************* ******************************
function FindColorCircleTolerance(var x, y: Integer; color, radius, MidPointx, MidPointy, tolerance: Integer): Boolean;
By: Freddy1990
Description: Searches for a color with a tolerance within a circle.
************************************************** *****************************}
function FindColorCircleTolerance(var x, y: Integer; color, radius, MidPointx,
MidPointy, tolerance: Integer): Boolean;
begin
Result := FindColorCircleD(x, y, color, radius, MidPointx, MidPointy,
tolerance);
end;
{************************************************* ******************************
function FindColorSkipBox(var x, y: Integer; color, x1, y1, x2, y2: Integer; box: TBox): Boolean;
By: Freddy1990
Description: Searches for a color in a square while skipping a square.
************************************************** *****************************}
function FindColorSkipBox(var x, y: Integer; color, x1, y1, x2, y2: Integer;
box: TBox): Boolean;
var
a, b: TPointArray;
begin
SetArrayLength(a, 1);
SetArrayLength(b, 1);
a[0] := cPoint2(box, 1);
b[0] := cPoint2(box, 2);
Result := FindColorSkipBoxD(x, y, color, x1, y1, x2, y2, 0, a, b);
end;
{************************************************* ******************************
function FindColorSkipBoxTolerance(var x, y: Integer; color, x1, y1, x2, y2, tolerance: Integer; box: TBox): Boolean;
By: Freddy1990
Description: Searches for a color in a square while skipping a square with a tolerance.
************************************************** *****************************}
function FindColorSkipBoxTolerance(var x, y: Integer; color, x1, y1, x2, y2,
tolerance: Integer; box: TBox): Boolean;
var
a, b: TPointArray;
begin
SetArrayLength(a, 1);
SetArrayLength(b, 1);
a[0] := cPoint2(box, 1);
b[0] := cPoint2(box, 2);
Result := FindColorSkipBoxD(x, y, color, x1, y1, x2, y2, tolerance, a, b);
end;
{************************************************* ******************************
function FindColorSkipBoxArray(var x, y: Integer; color, x1, y1, x2, y2: Integer; box: TBoxArray): Boolean;
By: Freddy1990
Description: Searches for a color in a square while skipping multiple squares.
************************************************** *****************************}
function FindColorSkipBoxArray(var x, y: Integer; color, x1, y1, x2, y2:
Integer; box: TBoxArray): Boolean;
var
a, b: TPointArray;
begin
a := cPointArray2(box, 1);
b := cPointArray2(box, 2);
Result := FindColorSkipBoxD(x, y, color, x1, y1, x2, y2, 0, a, b);
end;
{************************************************* ******************************
function FindColorSkipBoxArrayTolerance(var x, y: Integer; color, x1, y1, x2, y2, tolerance: Integer; box: TBoxArray): Boolean;
By: Freddy1990
Description: Searches for a color in a square while skipping multiple squares.
************************************************** *****************************}
function FindColorSkipBoxArrayTolerance(var x, y: Integer; color, x1, y1, x2,
y2, tolerance: Integer; box: TBoxArray): Boolean;
var
a, b: TPointArray;
begin
a := cPointArray2(box, 1);
b := cPointArray2(box, 2);
Result := FindColorSkipBoxD(x, y, color, x1, y1, x2, y2, tolerance, a, b);
end;
{************************************************* ******************************
function ScanMMColorExact(var x, y: Integer; color: Integer): Boolean;
By: Freddy1990
Description: Finds a color on the minimap. (minimap being 100% correct)
************************************************** *****************************}
function ScanMMColorExact(var x, y: Integer; color: Integer): Boolean;
begin
Result := ScanExactMinimapD(x, y, color, 0);
end;
{************************************************* ******************************
function ScanMMColorExactTolerance(var x, y: Integer; color, tolerance: Integer): Boolean;
By: Freddy1990
Description: Finds a color with a tolerance on the minimap. (minimap being 100% correct)
************************************************** *****************************}
function ScanMMColorExactTolerance(var x, y: Integer; color, tolerance:
Integer): Boolean;
begin
Result := ScanExactMinimapD(x, y, color, tolerance);
end;
{************************************************* ******************************
procedure ClickExactMMColor(color: Integer);
By: Freddy1990
Description: Clicks a color on the EXACT minimap
************************************************** *****************************}
procedure ClickExactMMColor(color: Integer);
var
x, y: Integer;
begin
if (ScanMMColorExact(x, y, color)) then
Mouse(x, y, 0, 0, True);
end;
{************************************************* ******************************
procedure ClickExactMMColorTol(color, tolerance: Integer);
By: Freddy1990
Description: Clicks a color with a tolerance on the EXACT Minimap.
************************************************** *****************************}
procedure ClickExactMMColorTol(color, tolerance: Integer);
var
x, y: Integer;
begin
if (ScanMMColorExactTolerance(x, y, color, tolerance)) then
Mouse(x, y, 0, 0, True);
end;
{************************************************* ******************************
function ScanMMAreaColorExact(var x, y: Integer; x1, y1, x2, y2, color: Integer): Boolean;
By: Freddy1990
Description: Finds a color in the specified rectangle on the minimap. (minimap being 100% correct)
************************************************** *****************************}
function ScanMMAreaColorExact(var x, y: Integer; x1, y1, x2, y2, color:
Integer): Boolean;
begin
Result := ScanExactMMAreaD(x, y, x1, y1, x2, y2, color, 0);
end;
{************************************************* ******************************
function ScanMMAreaColorExactTolerance(var x, y: Integer; x1, y1, x2, y2, color, tolerance: Integer): Boolean;
By: Freddy1990
Description: Finds a color in the specified rectangle with a tolerance on the minimap. (minimap being 100% correct)
************************************************** *****************************}
function ScanMMAreaColorExactTolerance(var x, y: Integer; x1, y1, x2, y2, color,
tolerance: Integer): Boolean;
begin
Result := ScanExactMMAreaD(x, y, x1, y1, x2, y2, color, tolerance);
end;