PHP Code:
{*******************************************************************************
Function FindMMColorCentreTol(var x, y : Integer; colour, tol : Integer): Boolean;
By: Krazy_Meerkat
Description: Searches for a color on the minimap using tolerance and then finds the centre
*******************************************************************************}
function FindMMColorCentreTol(var x, y : Integer; colour, tol : Integer): Boolean;
begin
if(FindMMColorTol(x, y, colour, tol))then
begin
FindColorSpiral2(x, y, (getcolor(x, y)), MMX1, MMY1, MMX2, MMY2);
Result:= True
end;
end;
{*******************************************************************************
Function FindSmallestColorTol(var x, y, finaltol : Integer; colour, xs, ys, xe, ye : Integer): Boolean;
By: Krazy_Meerkat
Description: Searches for a color finding the least amount of tolerance possible
*******************************************************************************}
function FindSmallestColorTol(var x, y, finaltol : Integer; colour, xs, ys, xe, ye : Integer): Boolean;
var
tol, range : Integer;
begin
tol:= 50
range:= tol div 4
repeat
if(not(FindColorSpiralTolerance(x, y, colour, xs, ys, xe, ye, tol)))then
begin
repeat
tol:= tol + range
until(FindColorSpiralTolerance(x, y, colour, xs, ys, xe, ye, tol))
tol:= tol - (range div 2)
range:= (range div 2)
end;
tol:= tol - range
until(range = 0)
Result:= True;
finaltol:= tol;
end;