SRL Archive - OSR Help

Getting out of range error


TsterT

2012-01-19 16:43:43

Getting the error on the red line here:

procedure SetTrap;
Var
i : Integer;
T : TPoint;
TPA : TPointArray;
ATPA : T2DPointArray;
begin
[COLOR="Red"] FindColorsTolerance(ATPA[i], treeColor, MSX1, MSY1, MSX2, MSY2, 3);[/COLOR]
TPA := MergeATPA(ATPA);
ATPA := SplitTPA(TPA, 6);
SortATPASize(ATPA, True);
T := MiddleTPA(ATPA[0]);
MMouse(T.x, T.y, 2, 2);
wait(RandomRange(300,400));
if(isUpText('oung tree')) then
begin
Mouse(T.x, T.y, 0, 0, mouse_right);
Inc(trapsSet);
players[CurrentPlayer].Loc := 'CheckTrap';
end;
end;

Uploaded full script below if that's any help.

Thanks,
TsterT

Kyle Undefined

2012-01-19 16:45:51

FindColorsTolerance(ATPA, treeColor, MSX1, MSY1, MSX2, MSY2, 3);

^ That should do it.

TsterT

2012-01-19 16:51:08

Then I get a type mismatch error ^^.

Kyle Undefined

2012-01-19 16:52:52

Meh, sorry, replace the ATPA with TPA in the FindColor function. Then take out the TPA := MergeATPA(); line, since you don't need it.

TsterT

2012-01-19 17:00:07

That did it, thanks!

:)