Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Assignment by list?

Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
06-02-2005 01:57
If there are a lot of elements to assign, those are messy.
Can I use lists to assign them?
For example,
CODE
list pos_vec [<1.0, 1.0, 0.0>, <1.2, 1.0, 0.0>, <1.5, 1.0, 0.0>, <1.7, 1.0, 0.0>,
<2.0, 1.0, 0.0>, <2.2, 1.0, 0.0>, <2.5, 1.0, 0.0>, <2.7, 1.0, 0.0>,
<3.0, 1.0, 0.0>, <3.2, 1.0, 0.0>, <3.5, 1.0, 0.0>, <3.7, 1.0, 0.0>,
<4.0, 1.0, 0.0>, <4.2, 1.0, 0.0>, <4.5, 1.0, 0.0>, <4.7, 1.0, 0.0>];

list pos_name [pos_01, pos_02, pos_03, pos_04, pos_05, pos_06, pos_07, pos_08,
pos_09, pos_10, pos_11, pos_12, pos_13, pos_14, pos_15, pos_16];

default
{
state_entry()
{
(vector)pos_name = pos_vec;
}
}
NO?
_____________________
:) Seagel Neville :)
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
06-02-2005 02:16
Erm...take another look at this and ask yourself where the variables pos_01, pos_02, etc came from... the answer would be:

vector pos_01;
vector pos_02;
vector ....etc.

So you might as well initialize them in the required declarations.

vector pos_01 = < ... >;

Alternatively, you could keep the list dump the variables and access via llList2Vector(pos_vec, index) if you need to iterate over all the pos literals...

/esc
_____________________
http://slurl.com/secondlife/Together
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
06-02-2005 08:49
I see... THX. :p
_____________________
:) Seagel Neville :)