Log in

View Full Version : [Bug] Out of Range at line 1121



Syntax
12-05-2012, 09:05 AM
Not sure if this is a bug but I can't run my script because of it (compiles perfectly). I get this error:

Error: Out Of Range at line 1121
The following DTMs were not freed: [SRL - Lamp bitmap, 1, 2]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap]


The issue code:


function HPPercent: Integer;
var
ColorString: string;
begin
if (Players[CurrentPlayer].Level[SKILL_HITPOINTS] < 1) then
Players[CurrentPlayer].Level[SKILL_HITPOINTS] := Max(1, GetSkillInfo('hitpoints', False));

if (Players[CurrentPlayer].Level[SKILL_HITPOINTS] > 1) then
Result := Round(GetMMLevels('hp', ColorString) * 10 / Players[CurrentPlayer].Level[SKILL_HITPOINTS])
else
Result := -1;
end;


and now my script:

program New;
//{$DEFINE SMART}
{$i srl/srl.simba}

procedure antiban;
var StartAngle, clicks, i: integer;
begin
StartAngle := round(rs_GetCompassAngleDegrees());
begin
i := random(90);
case (i) of
1: begin
KeyDown(VK_Left);
Wait((302)+random(50));
KeyUp(VK_Left);
IncEx(clicks, 1);
end;
2: begin
KeyDown(VK_Right);
Wait((302)+random(50));
KeyUp(VK_Right);
IncEx(clicks, 1);
end;
3: begin
KeyDown(40);
Wait((208)+random(50));
KeyUp(40);
IncEx(clicks, 1);
end;
4: begin
KeyDown(38);
Wait((201)+random(50));
KeyUp(38);
IncEx(clicks, 1);
end;
end;
end;
Wait(100+Random(50));
MakeCompass(StartAngle);
begin
case random(90) of
0: RandomRClick;
2: PickUpMouse;
3: RandomMovement;
4: BoredHuman;
5: ExamineInv;
end;
end;
end;
procedure destroymosses;
var
x, y:integer;
begin
wait(130+randomrange(130,210));
If FindColorSpiral(x, y, 5866618, MSX1, MSY1, MSX2,MSY2) then
writeln('Found Moss Giants attacking them soon');
repeat
wait(350);
until(not srl_InFight);
writeln('Currently in a fight, waiting for it to die');
begin
MMouse(x, y, 0, 0);
writeln('Script not failed yet');
begin
wait(100);
Mouse(x, y, 0, 0, true);
wait(3500+randomrange(300,340));
wait(100+randomrange(50,102));
Writeln('Moss giant should be dead soon');
end;
end;
end;
procedure heal;
var
x, y, shark: integer;
begin
if HPPercent>40 then
Writeln('We Definitely need to heal up!');
begin
if FindDTM(shark, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
MMouse(x, y, 5, 5);
Mouse(x, y, 0, 0, true);
Writeln('That shark healed some health');
FreeDTM(shark);
end;
end;
end;

procedure dtmz;
var
shark:integer;
begin
Writeln('Shark DTM has now been enabled');
shark := DTMFromString('mwQAAAHic42RgYLBjYmDwBmJzIDYEYjcg9o KyHYDYCogfAtV9AeLrQPwJiG8B8TMgfgql3wBxVZwrkGQkgAkD QiagmAIAZKMLiw==');
end;

procedure freedtmz;
var
shark:integer;
begin
Writeln('Shark DTM has now been disabled');
FreeDTM(shark);
end;
begin
SetUpSRL;
dtmz;
AddOnTerminate('freedtmz');
repeat
antiban;
destroymosses;
heal;
until(false);
freedtmz;
end.



I put a lot of unnecessary Writelns to be sure it wasn't a script error.

P1ng
12-05-2012, 09:18 AM
I think you need to have declare players in your script, I'd say that's why it's not working. Is this for Runescape or an RSPS? If it's an RSPS then HPPercent most probably won't work at all.

kazhual
12-11-2012, 09:53 AM
The problem is not in your script, a DTM is not being freed in the SRL.
Try updating SRL, if it is up to date try a forced update

P1ng
12-11-2012, 11:34 AM
The DTMs not being freed from SRL are a result of the forced termination due to the out of range error. Updating SRL will not fix that