SRL Archive - OSR Help

Out of Range Error


sportsguy217

2013-02-11 00:46:06

First off, I'm new to these forums and accidently tried to post this in another "mod approved" section twice before realizing I can come here. Sorry about that. So I found a rsps auto fighter bot, tried running it but I got
Error: Out Of Range at line 108
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Options Bitmap]

Here's line 108
 Mouse(TPA[i].X, TPA[i].Y, 0, 0, true);    

Here's the whole script
program Auto_Soulsplit_Fighter;
{$i srl/srl.simba}

//This Script Does Not Seem To Work On The SoulSplit Downloadable Client!


//It Does Work On The Web Client But You Need To Resize The Web Page To Fit The Client!


//If That Does Not Work You Can Use SwiftKit For Runescape And Open SoulSplit.
//There Are Details Online On How To Do That. (This Is What I Use)



//SETUP

// Please Login To SoulSplit Then Go To The Monster You Want To Kill,
// Use "Pick A Colour" And Get A Unique Monster Colour And Set A Colour Tolerance.
// When Ready To Run The Script Press "PAGE DOWN" To Fully Zoom Out And Keep
// The Camera Angle As Standard Or PixelShift Will NOT Work Properly.

// PixelShift May Need To Be Adjusted A Bit To Get It Working Perfect For You.

const
COLOR = 8894621; // Monster Colour
TOL = 15; // Colour Tolerance

///////////////////////////////////////////////////////
//PLEASE DO NOT TOUCH UNLESS YOU KNOW WHAT YOUR DOING//


function Click(): boolean;
var
x, y, w, h: integer;
B: TBox;
begin
GetMousePos(x, y);
w := 525;
h := 338;
GetClientDimensions(w, h);
B := IntToBox(x - 15, y - 15, x + 15, y + 15);
if B.x1 < 0 then B.x1 := 0;
if B.y1 < 0 then B.y1 := 0;
if B.x2 > w then B.x2 := w;
if B.y2 > h then B.y2 := h;
begin
if findColorTolerance(x, y, 62713, B.x1, B.y1, B.x2, B.y2, 20) then
begin
Result := True
Exit;
end;
end;
end;


Function YellowClick: Boolean;
begin
Result := Click;
end;


Function RedClick: Boolean;
begin
Result := Not Click;
end;


Function Moving: Boolean;
var
MovingBox: Tbox;
begin
MovingBox := IntToBox(259, 133, 272, 151);
Result := (AveragePixelShift(MovingBox, 500, 300) > 80);
//Writeln(IntToStr(AveragePixelShift(MovingBox, 500, 300))); //Shows PixelShift in debug

end;


Function InFight: Boolean;
var
InFightBox: Tbox;
begin
InFightBox := IntToBox(260, 137, 277, 185);
Result := (AveragePixelShift(InFightBox, 500, 300) > 100);
//Writeln(IntToStr(AveragePixelShift(InFightBox, 500, 300))); //Shows PixelShift in debug

end;


procedure FindMonster;
var
I, Kill : Integer;
Corners, TPA: TPointArray;

begin
Corners := [Point(266, 174), Point(0, 0), Point(580, 0), Point(0, 340), Point(580, 340)];// Corners of the client and center point
I := 0

begin
repeat
if I = 4 then
Exit;

if FindColorsSpiralTolerance(Corners[i].X, Corners[i].Y, TPA, COLOR, MSX1, MSY1, MSX2, MSY2, TOL) then
begin

MarkTime(Kill);
Mouse(TPA[i].X, TPA[i].Y, 0, 0, true);
Writeln('Attempting To Attack!');

if YellowClick then
begin
Writeln('');
Writeln('Missed!');
Writeln('Searching Again!');
Writeln('');
Continue;
end;

if RedClick then
begin
Wait(1500);

if (TimeFromMark(Kill) > 2000) and not Moving then
begin
Writeln('');
Writeln('Monster Already Infight');
i := i + 1;
Writeln('Searching Again!');
Writeln('');
Continue;
end else

if InFight then
begin
Writeln('Attacking!');
begin
repeat
Wait(200);
until not InFight and not Moving or (TimeFromMark(Kill) > 12000);
end;
Writeln('Monster Dead!');
Writeln('');
Wait(1500);
end;
end;
end;
until (false);
end;
end;



begin
SetupSRL;
ClearDebug;
begin
repeat
FindMonster;
until (false);
end;
end.

You enter the color, it finds the color, clicks the color then repeats. It attacks for a few minutes (less than 10) then I always get that error. I've already looked for the player.txt file in the simba msi folder and it wasn't there probably because I'm on a private server.

I know I've already got another thread down below as well, but this is an unrelated problem dealing with a completely different script. Basically if you can tell me what the error is, how to fix it, and how to avoid it in the future. Any help is appreciated!

riwu

2013-02-11 01:27:09

For script specific problems, you should post the error in the script's thread so that the author can fix it.

The TPA logic in that procedure is not appropriate and resulted in an out of range error due to it attempting to access higher indexes of the TPA when it does not in fact exist.

sportsguy217

2013-02-11 01:29:47

The developer said he won't be editing anymore, so I figured it'd be useless to ask him. I guess it wouldn't hurt :p thanks