Results 1 to 8 of 8

Thread: Out of range error

  1. #1
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default Out of range error

    I get an out of range error and I am unable to come up with any idea why its happening, can someone point out what i've done wrong here.

    P.S. All of the functions/procedure work perfectly its only the repeat loop thats giving me the problems for some strange reason)
    Simba Code:
    repeat
        while (GetAnimation = -1) and (not R_InvFull) do
        begin
          StartFishing;
          CheckRandomArea(3101, 3436, 3111, 3422);
          wait(2000);
          while (a < 5) and (CharacterMoving) do
          begin
            wait(1000);
            CheckRandomArea(3101, 3436, 3111, 3422);
          end;
          a := 0;
          while (not R_InvFull) and (GetAnimation = 623) do
          begin
            wait(200);
            CheckRandomArea(3101, 3436, 3111, 3422);
          end;
        end;
        fishes[0] := fishes[0] + R_CountItemID(331);  //salmon
        fishes[1] := fishes[1] + R_CountItemID(335);  //trout
        R_DropAllItemsIDEx([335, 331]);
        Inc(loads);
        writeln('Running for: ' + TimeRunning);
        writeln('Loads done: ' + IntToStr(loads));
        writeln('Fishing exp: ' + IntToStr(70 * fishes[0] + 50 * fishes[1]));
      until(loads = Players[0].Integers[0]); //<================ Error here!!!!!!!

    EDIT: SOLVED
    Last edited by KingKong; 12-28-2010 at 11:28 AM.

  2. #2
    Join Date
    Sep 2006
    Location
    Canada
    Posts
    1,124
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Out of range errors mean you are trying to access/write to an element of an array that doesn't exist.

  3. #3
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Nvm, I forgot to write DeclarePlayers in my script which holds Playeres[0].Integers[0]

  4. #4
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Does anyone know how to setlength's of more than one variable at the same time?

    Edit: Sry for the double post, but i didn't want to make another thread just for this one question

  5. #5
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    Kong, you can't, unless you make your own procedure/function.

    pascal Code:
    procedure SetLengthEx(Arrays: array of TIntegerArray; Lengths: TIntegerArray);
    var
      i: Integer;
    begin
      for i := 0 to High(Arrays) do
        SetLength(Arrays[i], Lengths[i]);
    end;

    Might work?

  6. #6
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    With that method, wouldn't it only work with integer arrays? if i had different types of arrays, then wouldn't it become really messy?

  7. #7
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    TVariantArray

    But I don't think it can be done that way. Just set the lengths as you normally do for all of the arrays.
    There used to be something meaningful here.

  8. #8
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    For some reason I thought that you could only set the lengths of TIntegerArrays.. :3

    But yeah, I really don't think you can with a loop or anything.

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
  •