Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

getting an integer from llGetListLength

Olympia Rebus
Muse of Chaos
Join date: 22 Feb 2004
Posts: 1,831
07-02-2004 18:42
How come this works...


list letters = ["a", "b", "c", "d", "e"];
default
{
state_entry()
{
llSay(0,(string)llGetListLength (letters));
}
}



but not this:


list letters = ["a", "b", "c", "d", "e"];

integer x = llGetListLength(letters);

As soon as I add the line about integer x = llGetListLength(letters) I get an error message.
What am I doing wrong? How can I make an integer equil to the value of llGetListLength?

Thanks in advance

Olympia
Rysidian Rubio
Ruby Red Head
Join date: 14 Jan 2004
Posts: 263
07-02-2004 20:43
Olympia it looks like you are putting the line:

integer x = llGetListLength(letters);

at the top of the script not inside any state or event. You can define global variables as you have done for the list 'letters' at the top of the script but you can't use any functions there as you have tried. try this instead..

list letters = ["a", "b", "c", "d", "e"];
integer x;

default
{
state_entry()
{
x = llGetListLength(letters);
llSay(0,(string)x);
}
}
Olympia Rebus
Muse of Chaos
Join date: 22 Feb 2004
Posts: 1,831
07-02-2004 21:20
Thanks Rysidian,
Works great!:D