Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Variables, script reset & rezzing

Cenji Neutra
www.apez.biz
Join date: 30 Oct 2004
Posts: 36
02-18-2005 13:46
Hi. I think I'm a little confused about the conditions under which script global variables keep or have their values initialized.
Here are specific questions I greatly appreciate some knowledgable help on.

1) Do script variables get automatically re-initialized on script reset?

2) Are script always reset if their containing object is rezzed?

3) Are scripts always reset when the sim server gets rebooted?

I guess I'd like to know how to geet the value of dynamically assigned variables.
If script reset initialized variables and sim reboots don't reset scripts,
then that would make it easy. Otherwise a script would have to rever to tying
to store variable somewhere (where?)
Thanks.
-Cenji
Rickard Roentgen
Renaissance Punk
Join date: 4 Apr 2004
Posts: 1,869
02-18-2005 13:52
1) They lose their current value on reset and are then reset to 0 or "" or [] if they have no initial value specified or to the specified value if there is one. the state_entry event is also run so if any variable are set there they will end up with that value.

2) Scripts are not reset on_rez unless specifically told to do so in the on_rez event. However. if you have copy permissions then the item taken out of your inventory is different than the one left in your inventory and the one in your inventory will have different values than the one in world. Duplicating an object using Ctrl-D or shift drag will cause the new object's scripts to reset, they don't keep the state of the original object.

3) This I'm not sure about, but I don't believe they get reset. I've occasionally seen them get turned off in which case I usually recompile them which resets them.
_____________________
Cenji Neutra
www.apez.biz
Join date: 30 Oct 2004
Posts: 36
02-19-2005 11:21
Thanks. That answers my question. Time to implemet a notecard config reader :)
Rickard Roentgen
Renaissance Punk
Join date: 4 Apr 2004
Posts: 1,869
02-19-2005 12:12
let me clarify number 2 just in case :). When you first take it out of inventory they are identical, values and all, but changes to the one in world do not effect the one in your inventory.
_____________________