Results 1 to 5 of 5

Thread: Out of range

  1. #1
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default Out of range

    Hey guys I've been working on a small project for the past few hours, and I'm stuck right now. Firstly, I haven't coded in a while so I'm asking if anyone knows a way to shorten the arrays.
    Simba Code:
    Function Handle: Boolean;
    var
      i, s: Integer;
      T: TRSObject;
      E: TNPC;
      TP, Tl: TPoint;
      ETiles, Tiles: TPointArray;
    begin
      if (Herbs) then
        s := 4
      else
        s := 5;
      Tiles[1] := Point(2906, 5488);
      Tiles[2] := Point(2909, 5490);
      Tiles[3] := Point(2911, 5485);
      Tiles[4] := Point(2921, 5485);
      Tiles[5] := Point(2924, 5487);

      ETiles[1] := Point(2907, 5484);
      ETiles[2] := Point(2907, 5493);
      ETiles[3] := Point(2910, 5489);
      ETiles[4] := Point(2915, 5484);
      ETiles[5] := Point(2923, 5487);
      ETiles[6] := Point(2922, 5491);
    The actual problem is this error i'm getting on the first array.
    Progress Report:
    Error: Out Of Range at line 206

  2. #2
    Join Date
    Mar 2007
    Posts
    3,116
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Simba Code:
    Function Handle: Boolean;
    var
      i, s: Integer;
      T: TRSObject;
      E: TNPC;
      TP, Tl: TPoint;
      ETiles, Tiles: TPointArray;
    begin
      if (Herbs) then
        s := 4
      else
        s := 5;
      SetArrayLenth(Tiles, 5);
      Tiles := [Point(2906, 5488), Point(2909, 5490), Point(2911, 5485), Point(2921, 5485), Point(2924, 5487)];

      SetArrayLenth(ETiles, 6);
      ETiles := [Point(2907, 5484), Point(2907, 5493), Point(2910, 5489), Point(2915, 5484), Point(2923, 5487), Point(2922, 5491)];

  3. #3
    Join Date
    Feb 2006
    Posts
    3,044
    Mentioned
    4 Post(s)
    Quoted
    21 Post(s)

    Default

    Kinda offtopic. But what's the use of SetArrayLength. I never use it.

    ~Home

  4. #4
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Home View Post
    Kinda offtopic. But what's the use of SetArrayLength. I never use it.

    ~Home
    Declares the size of the array.. I guess u could say it initiates the array with a size. You can't just use an array without declaring its size first. Though there is dynamic arrays, I don't know that simba supports that.. soo I guess thats what setarray length does.
    I am Ggzz..
    Hackintosher

  5. #5
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Actually, you should use SetLength() and Length() for arrays instead of SetArrayLength() and GetArrayLength()

    Reason: http://bugs.villavu.com/view.php?id=283

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
  •