Results 1 to 9 of 9

Thread: General Array Question

  1. #1
    Join Date
    Oct 2010
    Posts
    1,255
    Mentioned
    0 Post(s)
    Quoted
    15 Post(s)

    Default General Array Question

    Instead of doing

    Variable[0][0] := 1;
    Variable[0][1] := 2;

    Can you do

    Variable[0] := [1, 2];

    Just trying to figure out if that is what is wrong or it's something else in my script.

    If that won't work, then fuuuuuuuuu. My beautiful script aesthetics...
    I'm back

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

  3. #3
    Join Date
    Dec 2010
    Posts
    808
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    afaik, that should work.

    Gah, should of refreshed xD
    Ninja'd

    -Boom

  4. #4
    Join Date
    Oct 2010
    Posts
    1,255
    Mentioned
    0 Post(s)
    Quoted
    15 Post(s)

    Default

    So... error on this then.

    Simba Code:
    type
      QueueSystem = record
        Activity: Array[0..3] of Array[0..20] of Variant;
        RandomBreaks: Array[0..3] of Variant;
      end;

    var
      Queue: Array[0..9] of QueueSystem;

    Then in DeclarePlayers...

    Simba Code:
    Queue[0].RandomBreaks := [False, 0, 0];

    Gives me an error:

    Error: Could not call proc at line 71

    71 is the 'Queue[0].RandomBreaks := [False, 0, 0];'

    Thanks
    Last edited by smurg; 01-04-2011 at 08:23 PM.
    I'm back

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

    Default

    Afaik
    You can't do it like that when you have RandomBreaks: Array[0..3] of Variant;
    To make it work with RandomBreaks := blah you'd have to do RandomBreaks: Array of Variant;

  6. #6
    Join Date
    Oct 2010
    Posts
    1,255
    Mentioned
    0 Post(s)
    Quoted
    15 Post(s)

    Default

    Quote Originally Posted by Zyt3x View Post
    Afaik
    You can't do it like that when you have RandomBreaks: Array[0..3] of Variant;
    To make it work with RandomBreaks := blah you'd have to do RandomBreaks: Array of Variant;
    Ok, so just declare it, then setlength later I guess.

    Will try asap.
    I'm back

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

    Default

    You wont have to do SetLength() when doing Array := [];
    Array := []; will set the length for you

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

    Default

    Try
    SCAR Code:
    Queue[0].RandomBreaks := [TVariantArray([False, 0, 0])];
    If I understand you right, then it should be something as such, no?

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

    Default

    Whenever you use [0..X] you can't use [...] when declaring but if it's just array of Blank or TBlankArray then it should work.

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
  •