I use this on large static objects. I usually take a slice of the BitMap. (8*1 or 1*8)
SCAR Code:
{*******************************************************************************
function FindObjectDeformed(var ObjX, ObjY: Integer; UpText1, UpText2: String; BMP, a, b, c, d: Integer): Boolean;
By: WT-Fakawi
Description: Finds Object in Box a,b,c,d, specified by BitMap and Uptext1 or Uptext2
Returns coords in ObjX and ObjY.
Uses Deformed Bitmap. FindObjectDeformed will gradually lower Tol and reduce Accuracy.
Functon can cause severe Lag when using bitmaps bigger then 16 pixels. Works but Lags.
*******************************************************************************}
function FindObjectDeformed(var ObjX, ObjY: Integer; UpText1, UpText2: string;
BMP, a, b, c, d: Integer): Boolean;
var
acc, ref: Extended;
XT, YT, times, tol: Integer;
begin
ref := 0.9;
tol := 0;
for times := 1 to 50 do
begin
FindDeformedBitmapToleranceIn(BMP, XT, YT, a, b, c, d, tol, 2, True, acc);
if (acc >= ref) then
begin
MMouse(XT, YT, 0, 0);
Wait(400 + Random(400));
if (IsUpText(UpText1) or IsUpText(UpText2)) then
begin
ObjX := XT;
ObjY := YT;
Result := True;
Exit;
end;
end;
if times mod 5 = 0 then
begin
ref := ref - 0.1;
tol := tol + 10;
end;
Wait(1);
end;
end;