Results 1 to 8 of 8

Thread: Problem with arrays

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

    Default Problem with arrays

    SCAR Code:
    ClanChats[19].Name := 'hunt4stars';
      ClanChats[19].Msg[0][0] := 'Join "Merch Item" to make millions while hunting stars!';
      ClanChats[19].Msg[1] := DefaultMsg;//PROBLEM HERE
    [Runtime Error] : Type Mismatch in line 29 in script C:\Program Files\SCAR 3.23\Scripts\CCStealerLobby.scar

    SCAR Code:
    type
      CCInfo = record
        Name: String;
        Msg: Array[0..5] of Array[0..5] of String;
      end;

    var
      Viestit: Array of String;
      DefaultMsg: Array[0..5] of String;
      ClanChats: Array[0..50] of CCInfo;
      StartIndex, ChatIndex, Pmed: Integer;
      Name: String;
    [Runtime Error] : Type Mismatch in line 29 in script C:\Program Files\SCAR 3.23\Scripts\CCStealerLobby.scar
    Last edited by weequ; 07-20-2010 at 06:41 PM.

  2. #2
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    what line is line 29?

    ~shut

    EDIT: oh i see
    SCAR Code:
    ClanChats[19].Msg[1] := DefaultMsg;
    should be
    SCAR Code:
    ClanChats[19].Msg[1][0] := DefaultMsg;
    the second 0 could be another number, but it must be in the array

    what you were trying to do is assign a string to a array of string
    Last edited by Shuttleu; 07-20-2010 at 06:39 PM.

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

    Default

    Quote Originally Posted by Shuttleu View Post
    what line is line 29?

    ~shut

    EDIT: oh i see
    SCAR Code:
    ClanChats[19].Msg[1] := DefaultMsg;
    should be
    SCAR Code:
    ClanChats[19].Msg[1][0] := DefaultMsg;
    the second 0 could be another number, but it must be in the array

    what you were trying to do is assign a string to a array of string
    Check again becouse DefaultMsg is an array of String.

  4. #4
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Try SetArrayLength instead of preset lengths when you declare them.

    Edit:
    I'm thinking bc its Declared with a set length its giving that error. So if you set just the array length to 5 then leave the sub array length to its own device instead.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

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

    Default

    How about
    SCAR Code:
    ClanChats[19].Msg := DefaultMsg;
    There used to be something meaningful here.

  6. #6
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by Frement View Post
    How about
    SCAR Code:
    ClanChats[19].Msg := DefaultMsg;
    Msg is a 2DArray, DefaultMsg is just a single Array.

    Edit:
    Yeah I was right here:

    Works
    SCAR Code:
    program new;

    var
      Arr1: array of string;
      AAR: array of array of string;

    begin
      Arr1 := ['hi', 'yo', 'sup', 'kk', 'om nom nom'];

      SetArrayLength(AAR, 5);
      AAR[1] := Arr1;
    end.

    Does NOT Work
    SCAR Code:
    program new;

    var
      Arr1: array of string;
      AAR: array of array [0..4] of string;

    begin
      Arr1 := ['hi', 'yo', 'sup', 'kk', 'om nom nom'];

      SetArrayLength(AAR, 5);
      AAR[1] := Arr1;
    end.
    Last edited by Narcle; 07-20-2010 at 10:41 PM.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

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

    Default

    OK thanks ill try it today.

  8. #8
    Join Date
    Feb 2007
    Location
    Het ademt zwaar en moedeloos vannacht.
    Posts
    7,211
    Mentioned
    26 Post(s)
    Quoted
    72 Post(s)

    Default

    I reported this bug some time ago to Carlo (developer of scripting engine), and he's looking into it.
    I made a new script, check it out!.

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
  •