Results 1 to 5 of 5

Thread: [Runtime Error] : Out Of Range in line 37 in script

  1. #1
    Join Date
    Feb 2009
    Posts
    2,155
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default [Runtime Error] : Out Of Range in line 37 in script

    Code:
    {.include srl/srl.scar}
    
    procedure DeclarePlayers;//add more if needed
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      Players[0].Name       := '';
      Players[0].Pass       := '';
      Players[0].Nick       := '';
      Players[0].Active     := True;    // Use this account?
      Players[0].strings[0]:= 'bronze'; // what bar to smith
      players[0].pin:='';//bank pin
      Players[0].BoxRewards := ['XP', 'ostume', 'mote', 'Gem', 'ithril', 'oal'];
    end;
    
    procedure banker;
    begin
      openbankfast('akb');
      if bankscreen or pinscreen then
      begin
        writeln('opened bank');
      end else
      openbankglass('akb', true, true);
      if bankscreen or pinscreen then
      begin
        writeln('opened bank');
      end else
      Writeln('could not open bank.');
      if pinscreen then inpin(players[0].strings[1]);
    end;
    
    procedure getore;
    var
      mainamount, secamount : integer;
    begin
      case (Lowercase(Players[CurrentPlayer].Strings[0])) of
        'bronze':
        begin
          mainamount := 14;
          secamount:= 14;
        end;
        'iron':
        begin
          mainamount := 28; // Fill the acutal amounts in for the following though.
          secamount:= 0;
        end;
        'steel':
        begin
          mainamount := 9;
          secamount:= 18;
        end;
        'mithril':
        begin
          mainamount := 5;
          secamount:= 20;
        end;
        'addy':
        begin
          mainamount := 4;
          secamount:= 24;
        end;
        'runite':
        begin
          mainamount := 3;
          secamount:= 24;
        end;
      end;
      Withdraw(1, 1, mainamount);
      wait(100 + random(200));
      Withdraw(1, 2, secamount);
    end;
      
      
      
      
      
      
      
    procedure tofurnace;
    var
      cactusbmp : integer;
    begin
      makecompass('n')
      cactusbmp := BitmapFromString(12, 11, 'beNr7/x8NuKTKrOxMBCL' +
           'fUjMgWtQSC0RoaiBSyAqAjPX9qXCErACiBsIAGo5VAVwWzoaoQXMM' +
           'VjWYdkGsQ3MnJsLqHTSL0NSgqQeqQQ4cTDUQxyCrgbgZUz0IAABC6' +
           's+J');
      RadialWalk(AutoColorThis(cactusBmp, 15, MMX1, MMY1, MMX2, MMY2), 0, 120, 65, -1, 1)
      flag;
      writeln('to the cactus');
      writeln('crap didnt work')
    end;
    
    
    begin
      setupsrl;
      activateclient;
      banker;
      getore;
      tofurnace;
    end.
    it works fine till it actually gets the ores any help then i get the error

  2. #2
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    Does it keep running?

    T~M

  3. #3
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    try this
    SCAR Code:
    procedure getore;
    var
      mainamount, secamount : integer;
    begin
      case (Lowercase(Players[CurrentPlayer].Strings[0])) of
        'bronze':
        begin
          mainamount := 14;
          secamount:= 14;
        end;
        'iron':
        begin
          mainamount := 28; // Fill the acutal amounts in for the following though.
          secamount:= 0;
        end;
        'steel':
        begin
          mainamount := 9;
          secamount:= 18;
        end;
        'mithril':
        begin
          mainamount := 5;
          secamount:= 20;
        end;
        'addy':
        begin
          mainamount := 4;
          secamount:= 24;
        end;
        'runite':
        begin
          mainamount := 3;
          secamount:= 24;
        end;
        else Writeln('');
      end;
      Withdraw(1, 1, mainamount);
      wait(100 + random(200));
      Withdraw(1, 2, secamount);
    end;

  4. #4
    Join Date
    Jan 2008
    Location
    Frankfurt, Germany
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    lol, come on guys, it's obvious... he never called "DeclarePlayers" in the main loop.

    Hint: Things like the player array (or ddtms, dtms, bmps, etc.) need to be loaded, which means that they need to appear in the main loop, or in another procedure/function, which is in turned, called in the main loop.

    Fix:

    SCAR Code:
    {.include srl/srl.scar}

    procedure DeclarePlayers;//add more if needed
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      Players[0].Name       := '';
      Players[0].Pass       := '';
      Players[0].Nick       := '';
      Players[0].Active     := True;    // Use this account?
      Players[0].strings[0]:= 'bronze'; // what bar to smith
      players[0].pin:='';//bank pin
      Players[0].BoxRewards := ['XP', 'ostume', 'mote', 'Gem', 'ithril', 'oal'];
    end;

    procedure banker;
    begin
      openbankfast('akb');
      if bankscreen or pinscreen then
      begin
        writeln('opened bank');
      end else
      openbankglass('akb', true, true);
      if bankscreen or pinscreen then
      begin
        writeln('opened bank');
      end else
      Writeln('could not open bank.');
      if pinscreen then inpin(players[0].strings[1]);
    end;

    procedure getore;
    var
      mainamount, secamount : integer;
    begin
      case (Lowercase(Players[CurrentPlayer].Strings[0])) of
        'bronze':
        begin
          mainamount := 14;
          secamount:= 14;
        end;
        'iron':
        begin
          mainamount := 28; // Fill the acutal amounts in for the following though.
          secamount:= 0;
        end;
        'steel':
        begin
          mainamount := 9;
          secamount:= 18;
        end;
        'mithril':
        begin
          mainamount := 5;
          secamount:= 20;
        end;
        'addy':
        begin
          mainamount := 4;
          secamount:= 24;
        end;
        'runite':
        begin
          mainamount := 3;
          secamount:= 24;
        end;
      end;
      Withdraw(1, 1, mainamount);
      wait(100 + random(200));
      Withdraw(1, 2, secamount);
    end;
     
     
     
     
     
     
     
    procedure tofurnace;
    var
      cactusbmp : integer;
    begin
      makecompass('n')
      cactusbmp := BitmapFromString(12, 11, 'beNr7/x8NuKTKrOxMBCL' +
           'fUjMgWtQSC0RoaiBSyAqAjPX9qXCErACiBsIAGo5VAVwWzoaoQXMM' +
           'VjWYdkGsQ3MnJsLqHTSL0NSgqQeqQQ4cTDUQxyCrgbgZUz0IAABC6' +
           's+J');
      RadialWalk(AutoColorThis(cactusBmp, 15, MMX1, MMY1, MMX2, MMY2), 0, 120, 65, -1, 1)
      flag;
      writeln('to the cactus');
      writeln('crap didnt work')
    end;


    begin
      setupsrl;
      DeclarePlayers; // Here ya go
      activateclient;
      banker;
      getore;
      tofurnace;
    end.
    There is nothing right in my left brain and there is nothing left in my right brain.

  5. #5
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Grr, I knew that was it because there could be no other explanation as there is no problems with the procedure.

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
  •