SRL Archive - OSR Help

Out of range error


Troll

2011-02-15 16:27:38

Ok so i have been trying to make my first scirpt for the … too many count ive try so many times and given up.
I am new to everything coding but have come up with this and i belive i am using the arrays wrong. I get

Error: Out Of Range at line 164
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap]
File[C:\Simba\Includes\SRL/logs/SRL log 15-02-11 0.txt] has not been freed in the script, freeing it now.



Function MineRock:Boolean;
Var TheRocks,Part1,Part2,Part3:TRSObjectArray;
I,x,y :Integer;
RockTest:TRSObject;
XPoint :TPoint;
Begin
If Not LoggedIn Then Exit;

Part1 := GetObjectsByID(5770,0,30);
Part2 := GetObjectsByID(5771,0,30);
Part3 := GetObjectsByID(5772,0,30);

SetArrayLength(TheRocks,High(Part1));
For I := 0 To High(Part1) Do
TheRocks[I] := Part1[I];

SetArrayLength(TheRocks,(High(TheRocks)+High(Part2)));
For I := 0 To High(Part2) Do
TheRocks[(I+High(Part1))] := Part2[I];

SetArrayLength(TheRocks,(High(TheRocks)+High(Part3)));
For I := 0 To High(Part3) Do
TheRocks[(I+High(Part1)+High(Part2))] := Part3[I];

SortObjects(TheRocks);

For I := 0 To High(TheRocks) Do
Begin
If CheckRock(TheRocks[I].Tile) Then
If Not TileOnMS(Therocks[I].Tile,0) Then
If TileOnMM(TheRocks[I].Tile) Then
WalkToTile(TheRocks[I].Tile,3,4); //failsafe bit
If TileOnMS(Therocks[I].Tile,0) Then // just to check after walking
Begin
RockTest := GetObjectAt(TheRocks[I].Tile,0);
If (RockTest.ID = 5770) Or (RockTest.ID = 5771) Or (RockTest.ID = 5772) Then
XPoint := TileToPoint(RockTest.Tile);
MMouse(XPoint.x,XPoint.y,3,3);
If R_IsUpText('Mine Rocks') Then
Begin
GetMousePos(x,y);
If (Random(100) = 5) Then
Begin
Mouse(x,y,0,0,False);
R_ChooseOption('Mine Rocks');
Wait(RandomRange(400,1200));
If Not IsIdle Then
Begin
Result := True
writeln('minning rock');
Exit;
End;
End Else Begin
Mouse(X,Y,0,0,True);
Wait(RandomRange(400,1200));
If Not IsIdle Then
Begin
Result := True
writeln('minning rock');
Exit;
End;
End
End;
End;
End;
End;
and the line is

TheRocks[I] := Part1[I];

Thanks and sorry for posting so many questions and threads

YoHoJo

2011-02-15 16:34:17

Just a guess, maybe you need to SetArrayLegth for Part1, Part2, and Part3?

Troll

2011-02-15 16:42:11

From: YoHoJo
Just a guess, maybe you need to SetArrayLegth for Part1, Part2, and Part3?

Tryed it and it didnt work :(

Thanks though

E: This is on run time, as i wanted to test it as its the first part of my scirpt. I am setting up srl and ref then calling this