Krazy_Meerkat
2006-04-11 21:46:50
I have two here I just whipped up.
FindMMColorCentreTol was something I used in my sweet walking procedures, it's really good for clicking right in the middle of a particular floor colour. (I spelt colour the american way due to popularity)
FindSmallestColorTol is an idea that just popped into my head, if a colour is visable within the given co-ords then it will find the lowest possible tolerance for that colour. (The closest matching colour) It's really quite quick for the job it does ;)
[php]{*******************************************************************************
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;[/php]
FindMMColorCentreTol was something I used in my sweet walking procedures, it's really good for clicking right in the middle of a particular floor colour. (I spelt colour the american way due to popularity)
FindSmallestColorTol is an idea that just popped into my head, if a colour is visable within the given co-ords then it will find the lowest possible tolerance for that colour. (The closest matching colour) It's really quite quick for the job it does ;)
[php]{*******************************************************************************
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;[/php]