Results 1 to 3 of 3

Thread: Can you find out whats wrong with my script?

  1. #1
    Join Date
    Oct 2006
    Posts
    21
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Can you find out whats wrong with my script?

    I was working on my first script, (an autofighter) and i cant find out whats wrong with it!
    It will work at first, it fights 1 monster, then i get this error:

    SCAR Code:
    [Runtime Error] : Out Of Range in line 65 in script C:\Program Files\SCAR 2.03\includes\SRL/SRL/Skill/Fighting.scar

    Heres the script:

    SCAR Code:
    program AutoFighter1;

    {.include SRL/SRL.scar}
    {.include SRL/SRL/Skill/Fighting.scar}
    {.include SRL/SRL/extended/xAntiRandoms.scar}

    Const
      Color1= 15001575; //
      Color2= 10332585; //
      Color3= 1454660; //
      Color4= 15001575; //
      Color5= 10332585; //
      Color6= 1454660; //
      tol=5; //
      fightmode=1; //fightmode to use, 1-4
      monsterstokill=1000; //Number of monsters you want to kill

    Var
       Killed: Integer;
       Scriptl: Integer;
       TimeOut: Integer;

    procedure startup;
    begin
       SetupSRL;
       FindRs;
       PerfectNorth;
    end;

    procedure ABan;
    begin
     RotateEvery(5);
     AntiBan;
     FindMod;
     RandomMovement;
     BoredHuman;
    end;

    procedure Fighting;
    begin if not InFight then begin
       FightNPC(Color1, Color2, Color3, Color4, Color5, Color6, tol, TimeOut);
       killed:=killed+1
    end; end;

    procedure Progressreport;
    begin
        writeLn('Progress report')
        writeLn('killed: ' +inttostr(killed)+' monsters so far')
        writeLn('End Report')
      end;

    begin
     Startup;
     SetFightMode(FightMode);
     repeat
       ABan;
       FindNormalRandoms;
       progressreport;
       Fighting;
     until(killed=monsterstokill);
       Logout;
       Writeln('Finished Fighting, Logout')
    end.

  2. #2
    Join Date
    Sep 2006
    Posts
    161
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Usually that means you're supplying something with a value it can't use although the type is correct.

    The offending line is:

    Players[CurrentPlayer].Killed:=Players[CurrentPlayer].Killed+1;

    This is setting a value in the player array. The thing is, you don't have a player array. So it tries to write to a nonexistent array, and fails.

    http://www.villu-reborn.com/showthread.php?t=2506

    explains what you have to do to set up a player array.


    Wow. I've been away quite a while. Real life, yea, way unpredictable. Sorry, y'all, if I've caused any inconvenience.

  3. #3
    Join Date
    Oct 2006
    Posts
    21
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Cant Find Whats wrong with procedure.
    By kooldude in forum OSR Help
    Replies: 3
    Last Post: 03-20-2008, 07:45 AM
  2. whats wrong with this script
    By psychojamesd in forum OSR Help
    Replies: 3
    Last Post: 08-02-2007, 01:59 AM
  3. Whats wrong in my script?
    By Intef i i i in forum OSR Help
    Replies: 2
    Last Post: 04-10-2007, 03:29 PM
  4. whats wrong with this script?
    By fugate in forum OSR Help
    Replies: 14
    Last Post: 01-16-2007, 04:44 AM
  5. Replies: 7
    Last Post: 11-26-2006, 03:39 PM

Posting Permissions

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