Results 1 to 6 of 6

Thread: Declaring T(>3)DIntegerArray's

  1. #1
    Join Date
    Feb 2009
    Location
    Irvine, CA
    Posts
    2,873
    Mentioned
    8 Post(s)
    Quoted
    138 Post(s)

    Default Declaring T(>3)DIntegerArray's

    First off, this is difficult to word, so be warned!

    Declaring any series of "array of"'s more than 3 times of Integer arrays (TERRIBLE wording) manually gives a type mismatch error.

    Allow me to present some code for what i mean...
    Simba Code:
    program new;

    type
      T4DIntegerArray = array of array of array of array of Integer;

    var
      TheArray: T4DIntegerArray;

    procedure SetExampleT4DIntegerArray;
    begin
      TheArray :=
      [
        [
          [
            [0, 1], [1,0]
          ]
        ]
      ];
    end;

    begin
      SetExampleT4DIntegerArray;
    end.

    If you comment the only line in the main loop, it compiles on runtime so it must be declared properly. However, leaving it uncommented gives a type mismatch error.

    I know i can do this using a series of types, but filling in a long series of with..do's is too much for someone who has little programming knowledge (My dad wants this for a script for Evony).

    Now that I think about it, this should probably be in the Simba bugs section, but this section works fine too.

    Regards!

  2. #2
    Join Date
    Jan 2008
    Location
    10° north of Hell
    Posts
    2,035
    Mentioned
    65 Post(s)
    Quoted
    164 Post(s)

    Default

    WFM

    Simba doesn't like arrays inside of arrays "[[]]".
    Instead of settings it like that use
    "Arr[X] := [];"

    Simba Code:
    program new;

    type
      T3DIntegerArray = array of T2DIntegerArray;
      T4DIntegerArray = array of T3DIntegerArray;

    var
      TestArr: T4DIntegerArray;

    begin
      SetLength(TestArr, 1);
      SetLength(TestArr[0], 1);
      SetLength(TestArr[0][0], 1);
      TestArr[0][0][0] := [1, 5, 8];
      WriteLn(TestArr);
    end.

    Dg's Small Procedures | IRC Quotes
    Thank Wishlah for my nice new avatar!
    Quote Originally Posted by IRC
    [22:12:05] <Dgby714> Im agnostic
    [22:12:36] <Blumblebee> :O ...you can read minds

  3. #3
    Join Date
    Feb 2009
    Location
    Irvine, CA
    Posts
    2,873
    Mentioned
    8 Post(s)
    Quoted
    138 Post(s)

    Default

    WFM?

    And okay, that works I guess.

  4. #4
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    WFM = Works For Me

    Quote Originally Posted by TomTuff View Post
    WFM?

    And okay, that works I guess.

  5. #5
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    You can also do:

    Simba Code:
    var
      2darr: T2DIntegerArrary;
    begin
      2DArr := [TIntegerArray([0,3,3,4])];
    end;
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  6. #6
    Join Date
    Mar 2007
    Posts
    1,700
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    You can also do:

    Simba Code:
    var
      2darr: T2DIntegerArrary;
    begin
      2DArr := [TIntegerArray([0,3,3,4])];
    end;
    Horray!!!

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
  •