Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Global evaluated initializers

Grim Lupis
Dark Wolf
Join date: 11 Jul 2003
Posts: 762
08-06-2003 10:52
It would be nice to have global evaluated initilizers, such as:

CODE

key gkOwner = llGetOwner();
rotation grMyRot = llGetLocalRot();
rotation grOffsetRot = llEuler2Rot(<0,0,90> * DEG_TO_RAD);
rotation grNewRot = grMyRot * grOffsetRot;


This would be especially nice if we also get constants (see other post). Actually, it would almost be a necessity.

And, of course, if we ever get state-scoped variables, It would be nice if they could be initialized this way, too.

I realize we can "simulate" this by using state_entry(){}, this just seems more "proper," somehow.

Especially in light of the recent discovery (by Ama Omega) that state_entry() is NOT always the first event fired in any given state.
_____________________
Grim

"God only made a few perfect heads, the rest of them he put hair on." -- Unknown
Madox Kobayashi
Madox Labs R&D
Join date: 28 Jun 2003
Posts: 402
08-07-2003 10:17
If you mean global stuff being initialize like:

vector pos = llGetPos();

default {
state_entry()
{
...
}

...
}


as far as I know you can do this. I do it all the time...
_____________________
Madox Kobayashi

Grim Lupis
Dark Wolf
Join date: 11 Jul 2003
Posts: 762
08-07-2003 10:25
I tried something along these lines once, and it failed.

I think it likely, however, that my attempted initialization was a calculation, not a simple function call.

I'm not at home right now, so I can't try to reproduce the error I got, but I believe it was something along the lines of:

CODE

llEuler2Rot(<0,0,90> * DEG_TO_RAD);


Now that I think about it, it might take me awhile to figure out what I was trying to do. Since the script wouldn't compile, I couldn't save it, so I don't still have the broken copy anywhere.
_____________________
Grim

"God only made a few perfect heads, the rest of them he put hair on." -- Unknown