Good script, but for some reason after about 3-5 hours, I get a Runtime Error saying Scar's memory is full. Then it directs me to this line saying its the problem.
SCAR Code:
setlength(Points, length(Points)+1);
Anyway, that is from this function here:
SCAR Code:
function FindMultiMovementColorTol(TStop, Frequency : Integer; ColorMoving : Integer;
x1, y1, x2, y2 : Integer; Tolerance : Integer; MCPixels : Integer) : boolean;
var
TSearch, PCount, CCount, MCCount, slength, sheight, i, k : Integer;
Movement : Boolean;
begin
slength := (x2 - x1);
sheight := (y2 - y1);
PCount := 0; CCount := 0;
for i := 0 to sheight do
begin
if (i = 0) or ((i mod 2) = 0) then
begin
for k := 0 to (slength/2) do
begin
setlength(Points, length(Points)+1);
Points[PCount].x := (x1 + (2*k));
Points[PCount].y := (y1 + i);
PCount := (PCount + 1);
end;
end else
begin
if((slength mod 2) = 0) then
begin
for k := 0 to ((slength/2) - 1) do
begin
setlength(Points, length(Points)+1);
Points[PCount].x := (x1 + 1 + (2*k));
Points[PCount].y := (y1 + i);
PCount := PCount + 1;
end;
end else
begin
for k := 0 to (slength/2) do
begin
setlength(Points, length(Points)+1);
Points[PCount].x := (x1 + 1 + (2*k));
Points[PCount].y := (y1 + i);
PCount := (PCount + 1);
end;
end;
end;
end;
MarkTime(TSearch);
repeat
for i := 0 to (PCount - 1) do
begin
setlength(Points[i].Color, length(Points[i].Color)+1);
Points[i].Color[CCount] := GetColor(Points[i].x, Points[i].y);
end;
CCount := CCount + 1;
Wait(Frequency);
until(TimeFromMark(TSearch) > TStop);
for i := 0 to (PCount - 1) do
begin
Movement := False;
for k := 0 to (CCount - 2) do
begin
if(Points[i].Color[k] <> Points[i].Color[k+1]) then Movement := True;
end;
if Movement then
begin
for k := 0 to (CCount - 1) do
begin
if(SimilarColors(Points[i].Color[k], ColorMoving, Tolerance)) then MCCount := MCCount + 1;
end;
end;
end;
if(MCCount >= MCPixels) then Result := True
else Result := False;
end;
Any clue why it would be doing this?