Macrosoft
2007-12-01 11:26:54
This function will find a series of bitmaps or DTMs within a given time. It will wait MaxTime miliseconds for the next bitmap or DTM. I guess it could be useful for finding moving things.
Also, does anyone know of a FindDTMTol or somthing?
{*******************************************************************************
function FindAnimation(var x, y: Integer; DTMsOrBitmaps: TIntegerArray; x1, y1, x2, y2, MaxTime, Tol: Integer; DTM: Boolean): Boolean;
By: Macrosoft
Description: Finds a series of DTMs or Bitmaps within a given time. It
will wait MaxTime for the next Bitmap or DTM. DTM should be set to True
if using DTMs and False if using Bitmaps.
*******************************************************************************}
function FindAnimation(var x, y: Integer; DTMsOrBitmaps: TIntegerArray; x1, y1, x2, y2, MaxTime, Tol: Integer; DTM: Boolean): Boolean;
var
i, a, aLength: Integer;
begin
aLength := GetArrayLength(DTMsOrBitmaps);
if(DTM=True)then
begin
for i:=0 to aLength-1 do
begin
a:=0;
repeat
begin
wait(10);
a:=a+1
end;
until (FindDTM(DTMsOrBitmaps[i], x, y, x1, y1, x2, y2) or (a / 10=MaxTime));
if(a/10=MaxTime) then
begin
Result:=False;
Exit;
end;
end;
end else
begin
for i:=0 to aLength-1 do
begin
a:=0;
repeat
begin
wait(10);
a:=a+1
end;
until (FindBitMapToleranceIn(DTMsOrBitmaps[i], x, y, x1, y1, x2, y2, Tol) or (a/10=MaxTime));
if(a/10=MaxTime) then
begin
Result:=False;
Exit;
end;
end;
Result:=True;
end;Also, does anyone know of a FindDTMTol or somthing?