Results 1 to 8 of 8

Thread: Out of range

  1. #1
    Join Date
    Nov 2006
    Posts
    2,369
    Mentioned
    4 Post(s)
    Quoted
    78 Post(s)

    Default Out of range

    Solved.
    Last edited by weequ; 04-10-2010 at 05:11 PM.

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

    Default

    You need to set the length of T2D[I], I think.

    Would you mind showing the whole script? Could be a problem with the array NoFindBoxes aswell.

  3. #3
    Join Date
    Nov 2006
    Posts
    2,369
    Mentioned
    4 Post(s)
    Quoted
    78 Post(s)

    Default

    Quote Originally Posted by Naum View Post
    You need to set the length of T2D[I], I think.

    Would you mind showing the whole script? Could be a problem with the array NoFindBoxes aswell.
    I edited with the whole script
    And btw it just worked once but 95% of the time it gets the error

  4. #4
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Might be because you mess with the Length of T2D[I] in the middle of a loop (shortening it) and then when it goes to the next step in the loop its out of range because the high is smaller. " SetArrayLength(T2D[I], L2-1);" <-> "for II := 0 to High(T2D[I]) do"

  5. #5
    Join Date
    Nov 2006
    Posts
    2,369
    Mentioned
    4 Post(s)
    Quoted
    78 Post(s)

    Default

    Quote Originally Posted by IceFire908 View Post
    Might be because you mess with the Length of T2D[I] in the middle of a loop (shortening it) and then when it goes to the next step in the loop its out of range because the high is smaller. " SetArrayLength(T2D[I], L2-1);" <-> "for II := 0 to High(T2D[I]) do"
    But as you can see I have that WriteLn('a'); in that function and it only prints it once so it can't have gone that far in the script

    Edit: You can only see in the whole script :P
    Last edited by weequ; 04-08-2010 at 04:02 PM.

  6. #6
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by antti mies View Post
    But as you can see I have that WriteLn('a'); in that function and it only prints it once so it can't have gone that far in the script

    Edit: You can only see in the whole script :P
    That's in a different spot

    SCAR Code:
    for II := 0 to High(T2D[I]) do    
    for III := 0 to High(NoFindBoxes) do    
    if PointInBox(T2D[I][II], NoFindBoxes[III]) then    
    begin      
      L := High(T2D[I]);      
      Swap(T2D[I][II], T2D[I][L]);    
      L2 := Length(T2D[I])      
      SetArrayLength(T2D[I], L2-1);    
    end;

  7. #7
    Join Date
    Nov 2006
    Posts
    2,369
    Mentioned
    4 Post(s)
    Quoted
    78 Post(s)

    Default

    Ok i think ill do some more debugging but now i have to go school

  8. #8
    Join Date
    Nov 2006
    Posts
    2,369
    Mentioned
    4 Post(s)
    Quoted
    78 Post(s)

    Default

    Thanks icefire.
    All I had to do was to add a break;

    Code:
    for II := 0 to High(T2D[I]) do   
    for III := 0 to High(NoFindBoxes) do   
    if PointInBox(T2D[I][II], NoFindBoxes[III]) then   
    begin     
      L := High(T2D[I]);     
      Swap(T2D[I][II], T2D[I][L]);     
      L2 := Length(T2D[I])     
      SetArrayLength(T2D[I], L2-1);
      Break; // <---- HERE   
    end;
    Last edited by weequ; 04-10-2010 at 01:50 PM.

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
  •