fre
2012-02-14 14:07:13
Can someone tell me why this script gives an error out of range?
The error comes at lines with Door, if i comment the first line with Door in it it gives an error at the next line with Door in it.
Sometimes the procedure works, sometimes it gives the error.
Spend all day figuerin out why but i can't find it.
i would really appreciate it if someone could help me with this.
Thx
The error comes at lines with Door, if i comment the first line with Door in it it gives an error at the next line with Door in it.
Sometimes the procedure works, sometimes it gives the error.
Spend all day figuerin out why but i can't find it.
i would really appreciate it if someone could help me with this.
Thx
procedure OpenSomeDoors(ReLocate: Boolean);
var
x, y, i, MMDoor: Integer;
DoorColors: TPointArray;
Door: T2DPointArray;
Angle: Extended;
begin
if ReLocate then
begin
MMDoor:= DTMFromString('mWAAAAHicY2FgYFBhY2CwAWInILYF4udAsXtA/AyI3wNxUacew1dmVjj+DxTjR8KMQMyMhEEAABJuCew=');
if FindDTMRotatedAlternating(MMDoor, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/30, Pi/30, Pi/Pi, Angle) then
begin
Mouse(x, y, 1, 1, true);
Flag;
FreeDTM(MMDoor);
wait(1000+random(1000));
end;
end;
if FindColorsSpiralTolerance(MSX2/2, MSY2/2, DoorColors, 3561082, MSX2/2, MSY1, MSX2, MSY2, 25) then
begin
writeln('length = ' + tostr(length(DoorColors)));
Door := SplitTPA(DoorColors, 5);
writeln('length 2 = ' + tostr(length(Door)));
if Length(Door) = 0 then
begin
FindColorsSpiralTolerance(MSX2/2, MSY2/2, DoorColors, 3561082, MSX2/2, MSY1, MSX2, MSY2, 40);
Door := SplitTPA(DoorColors, 5);
end;
for i := 0 to length(Door) do
if (length(Door[i]) > 500) and (length(Door[i]) < 1300) then
begin
Smart_ClearCanvas;
writeln(tostr(length(door[i])));
SMart_drawdots(Door[i]);
wait(500);
MiddleTPAEx(Door[i], x, y);
Mmouse(x, y, 1, 1);
wait(500+random(100));
if IsUpText('lose') then
begin
Writeln('Debuggin purpose');
Exit;
end;
if IsUpText('pen') then
begin
Clickmouse2(True);
writeln('Debugging purpose');
Exit;
end;
writeln('lol');
end;
end;
end;