Results 1 to 4 of 4

Thread: Out of Range at line 1121

  1. #1
    Join Date
    Nov 2011
    Location
    Australia
    Posts
    418
    Mentioned
    2 Post(s)
    Quoted
    86 Post(s)

    Default Out of Range at line 1121

    Not sure if this is a bug but I can't run my script because of it (compiles perfectly). I get this error:
    Code:
    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:

    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:
    Code:
    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('mwQAAAHic42RgYLBjYmDwBmJzIDYEYjcg9oKyHYDYCogfAtV9AeLrQPwJiG8B8TMgfgql3wBxVZwrkGQkgAkDQiagmAIAZKMLiw==');
      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.

  2. #2
    Join Date
    Apr 2012
    Location
    Australia
    Posts
    1,252
    Mentioned
    1 Post(s)
    Quoted
    22 Post(s)

    Default

    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.

  3. #3
    Join Date
    Jan 2012
    Location
    Netherlands
    Posts
    76
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    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

  4. #4
    Join Date
    Apr 2012
    Location
    Australia
    Posts
    1,252
    Mentioned
    1 Post(s)
    Quoted
    22 Post(s)

    Default

    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •