Index Out Of Range

Discussion in 'Scar/Simba Help' started by Anime, Sep 24, 2008.

Index Out Of Range
  1. Unread #1 - Sep 24, 2008 at 9:47 PM
  2. Anime
    Referrals:
    0

    Anime Guest

    Index Out Of Range

    Code:
    Code:
    var
      Mobiles : array of TNPC;
      Index : Integer;
    begin
      Mobiles := GetNPCsByID( mobile );
      for Index := 0 to GetArrayLength( Mobiles ) - 1 do
        begin
        Writeln( 'Index: ' + IntToStr( Index ) );
        Writeln( 'Name: ' + Mobiles[Index].name );
        Writeln( 'ID: ' + IntToStr( Mobiles[Index].NPCType ) );
      end;
      if not TileOnMS( Mobiles[0].tile, Player.Height ) then
      begin
        WalkToTile( Mobiles[0].tile, 5, 1 );
        Wait( 500 + Random( 250 ) );
      end;
        Result := TileToMS( Mobiles[0].tile, Player.Height );
    end;
    I used this as a way to check the index of the NPC I'm looking for:
    Code:
    for Index := 0 to GetArrayLength( Mobiles ) - 1 do
        begin
        Writeln( 'Index: ' + IntToStr( Index ) );
        Writeln( 'Name: ' + Mobiles[Index].name );
        Writeln( 'ID: ' + IntToStr( Mobiles[Index].NPCType ) );
      end;
    The index of the NPC that I'm lookng for was '0'.

    My script crashes when I use:
    Code:
      if not TileOnMS( Mobiles[0].tile, Player.Height ) then
    I get a out of range error.

    How can it be out of range if it printed Mobiles[0] in the debug?
     
< fill out what on a scar script? | [Help] <---(i need lots) >

Users viewing this thread
1 guest


 
 
Adblock breaks this site