SRL Archive - OSR Help

General Array Question


smurg

2011-01-04 13:39:04

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…

Shuttleu

2011-01-04 14:03:08

yes that will work

~shut

**BANNED The Man

2011-01-04 14:13:14

afaik, that should work.

Gah, should of refreshed xD
Ninja'd

-Boom

smurg

2011-01-04 15:19:09

So… error on this then.


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…


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

Gu3st...

2011-01-04 17:56:19

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;

smurg

2011-01-04 18:12:50

From: Zyt3x
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.

Gu3st...

2011-01-04 18:15:17

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

Naum

2011-01-04 18:27:03

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

Wanted

2011-01-04 19:54:13

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.