SRL Archive - Research & Development Lounge

FindAnimation <--Finds a series of bitmaps or DTMs within a given time!


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.

{*******************************************************************************
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?

mat_de_b

2007-12-01 11:43:37

To make tolerance in a DTM increase the point size or increase the color tolerance…

Macrosoft

2007-12-01 11:49:28

so how would i do this in the func? or would the person do it manually?

n3ss3s

2007-12-01 12:16:06

Use a DDTM…

Gj though, but this kinda wouldn't work, angle changing of even ten degrees makes the DTMs useless.

stupedspam

2007-12-01 12:16:47

Just make it it make a DDTM and check it every couple mill. secs.

Look up tuts on DDTM… Thats your solution :D

Hope this helps,
~Stupedspam

Edit: Beat by n3ss3s….

Macrosoft

2007-12-01 12:40:32

i can use dtmrotated to search for a rotated dtm…

kk ill try ddtms

R0b0t1

2007-12-01 14:32:21

Actually, if you want tolerance, you would need to tell the user to include it in the DTM they make.

Macrosoft

2007-12-02 12:18:54

yeah, thats what i was thinking