Generic Function for finding any kind of tree. (Taken directly from Ratz.)
SCAR Code:
//----------------------------------------------------------------------------//
function FindTreeDeformed(var ObjX, ObjY :integer; UpText1, UpText2: String; BMP, a, b, c, d: integer): Boolean;
var
acc, ref : Extended;
var
XT, YT,times,tol : Integer;
begin
ref := 0.9;
tol := 0;
for times := 1 to 4 do
begin
FindDeformedBitmapToleranceIn(BMP, XT, YT, a, b, c, d, tol, 2, True, acc);
if (acc >= ref) then
begin
MMouse(XT + 8, YT, 0, 0);
if (IsUpText(UpText1) or IsUpText(UpText2)) then
begin
ObjX := XT;
ObjY := YT;
Result := True;
Exit;
end;
end;
ref := ref - 0.1;
tol := tol+10;
if FawkiDebug then Status('A '+FLoatToStr(acc)+'. R '+ FLoatToStr(ref)+ '. T '+IntToStr(tol));
FTWait(1);
end;
end;
And this is the Bitmap I work with. It is a "slice" 8*1, that works very well for "static" objects, both horizontal as well as vertical. Provided your PC is very fast, you will notice some lag in operation, but I take that for granted because I wish to click 100% accurate. I use this method for detecting anvils, furnaces, doors, banks, trees, minimap objects etc.