|
Dylan Rickenbacker
Animator
Join date: 11 Oct 2006
Posts: 365
|
10-31-2007 02:47
Hi, I'm trying to declare this global variable:
string gOwnerName = llKey2Name(llGetOwner());
This is the first line of my script (before the default state), and it gives me a syntax error. Can someone please explain why?
Thanks!
|
|
DanielFox Abernathy
Registered User
Join date: 20 Oct 2006
Posts: 212
|
10-31-2007 02:53
You are calling two functions to set the value of your string. Since its outside of any state, when do those functions get called? The answer is, never  Just declare it globally string gOwnerName; Then assign to it when you're actually in a code block, like state_entry.
|
|
Django Yifu
Beat Island Gaffer
Join date: 7 May 2007
Posts: 189
|
10-31-2007 04:02
DanielFox has hit the nail on the head.
You can state the value of a global if it is an actual value rather than the result of a call.
E.g
integer number = 5;
or
string statement = foo;
etc
but you can't use an lsl call like llGetOwner() as the script has no opportunity to make the call and get the information before the default state.
_____________________
Tread softly upon the Earth for you walk on my face.
|