Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Script components and when they're reset.

Sparky Brewster
Registered User
Join date: 16 Feb 2006
Posts: 6
03-01-2006 06:27
I've come across some bugs in my scripts that have to do with when things outside of the control of the script happen to the object containing the script.

Generally they have to do with various aspects of the script either being reset, or not being reset that suprise me. I haven't been able to find a wiki page that summarizes all of these things. If you can help me answer some various scenarios, I'll happily make a pretty grid and add it to bottom of the "reset" page of the wiki.


I've identified the following things that could be reset (what have I missed?):

Script variables
- Any variable stored globally in the script. When reset, they take their initial default values.
UUID
- When the event happens, does the prim that contains the script remain constant (doesn't reset), or is a new one generated (is reset)?
Listeners
- When the event happens, do listeners stay enabled?
XMLRPC Com Channel
- When the event happens, does the com channel remain open and valid?
Script State
- When the event happens, does the script's state get reset to default?
on_rez
- When the event happens, does the on_rez event get called?
state_entry
- When the event happens, does the state_entry event get called?
state_exit
- When the event happens, does the state_exit event get called?
Permissions
- When the event happens, does the script lose previously granted permissions?
Execution
- When the event happens, does execution of the script immiedatly get suspended, or does the currently executing block finish first?

Various events that could happen (Assume we're always talking about an object with a script unless otherwise specified):

Object is rezzed.
Object gets "taken"
Object has a copy taken (the original)
Object has a copy taken (the copy)
Object is copied while in inventory (the original)
Object is copied while in inventory (the copy)
Script is dropped into an object.
A script in an object is edited & recompiled.
A script in an object is reset.
A script in an attachment when the user logs out.
A script in an attachment when the user crosses sim boundries.
A script in an attachment when the user teleports & gets the loading screen..
(Again, did I miss any?)

So here's my intial guesses based on what I know so far:

Object is rezzed
- NO Script variables reset?
- NO UUID changed?
- YES Listeners still valid?
- ?? XMLRPC Com Channel still valid?
- NO Script State reset to default?
- YES on_rez run?
- NO state_entry run?
- NO state_exit run?
- YES Permissions still valid?
- N/A Execution suspends? (N/A because wasn't already running)

Object gets "taken"
- NO Script variables reset?
- NO UUID changed?
- YES Listeners still valid?
- YES XMLRPC Com Channel still valid?
- NO Script State reset to default?
- NO on_rez run?
- NO state_entry run?
- NO state_exit run?
- YES Permissions still valid?
- NO Execution suspends?

Object has a copy taken (the original)
- NO Script variables reset?
- NO UUID changed?
- YES Listeners still valid?
- YES XMLRPC Com Channel still valid?
- NO Script State reset to default?
- NO on_rez run?
- NO state_entry run?
- NO state_exit run?
- YES Permissions still valid?
- NO Execution suspends?

Object has a copy taken (the copy)
- YES Script variables reset?
- YES UUID changed?
- Listeners still valid?
- NO XMLRPC Com Channel still valid?
- YES Script State reset to default?
- NO on_rez run?
- NO state_entry run?
- NO state_exit run?
- YES Permissions still valid?
- YES Execution suspends?

Object is copied while in inventory (the original)
- NO Script variables reset?
- NO UUID changed?
- ?? Listeners still valid?
- ?? XMLRPC Com Channel still valid?
- ?? Script State reset to default?
- NO on_rez run?
- NO state_entry run?
- NO state_exit run?
- ?? Permissions still valid?
- N/A Execution suspends?

Object is copied while in inventory (the copy)
- YES Script variables reset?
- YES UUID changed?
- ?? Listeners still valid?
- ?? XMLRPC Com Channel still valid?
- ?? Script State reset to default?
- NO on_rez run?
- NO state_entry run?
- NO state_exit run?
- ?? Permissions still valid?
- N/A Execution suspends?

Script is dropped into an object.
- YES Script variables reset?
- NO UUID changed? (The object dropped onto does not change)
- NO Listeners still valid?
- NO XMLRPC Com Channel still valid?
- YES Script State reset to default?
- NO on_rez run?
- NO state_entry run?
- NO state_exit run?
- NO Permissions still valid?
- NO Execution suspends?

A script in an object is edited & recompiled.
- YES Script variables reset?
- NO UUID changed?
- NO Listeners still valid?
- NO XMLRPC Com Channel still valid?
- YES Script State reset to default?
- NO on_rez run?
- YES state_entry run?
- NO state_exit run?
- NO Permissions still valid?
- NO Execution suspends?

A script in an object is reset.
- YES Script variables reset?
- NO UUID changed?
- NO Listeners still valid?
- NO XMLRPC Com Channel still valid?
- YES Script State reset to default?
- NO on_rez run?
- YES state_entry run?
- NO state_exit run?
- NO Permissions still valid?
- NO Execution suspends?

A script in an attachment when the user logs out.
- NO Script variables reset?
- NO UUID changed?
- ?? Listeners still valid?
- ?? XMLRPC Com Channel still valid?
- NO Script State reset to default?
- NO on_rez run?
- NO state_entry run?
- ?? state_exit run?
- YES Permissions still valid?
- YES Execution suspends?

A script in an attachment when the user crosses sim boundries.
- NO Script variables reset?
- NO UUID changed?
- YES Listeners still valid?
- ?? XMLRPC Com Channel still valid?
- NO Script State reset to default?
- NO on_rez run?
- NO state_entry run?
- NO state_exit run?
- YES Permissions still valid? (For the person wearing)
- NO Permissions still valid? (For everyone else)
- NO Execution suspends?

A script in an attachment when the user teleports & gets the loading screen..
- NO Script variables reset?
- YES UUID changed?
- YES Listeners still valid?
- ?? XMLRPC Com Channel still valid?
- NO Script State reset to default?
- YES on_rez run?
- NO state_entry run?
- NO state_exit run?
- YES Permissions still valid?
- NO Execution suspends?


Please feel free to respond answering any of the "??" entries, or letting me know I got any of my initial guesses wrong. I'll update this post as those come in.

-Sparky
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
03-01-2006 07:19
There's too much here to deal with all at once, so I'll do a bit -


Object is rezzed
- NO Script variables reset? - unless there's an on_rez event that does something with them, or resets the script, or...
- NO UUID changed? - wrong. Rerezzing DEFINITELY issues a new key.
- ?? Listeners still valid? - unless changed by part of the script.
- ?? XMLRPC Com Channel still valid? - no idea
- NO Script State reset to default? - correct
- YES on_rez run? - obviously
- YES state_entry run? - no, unless the on_rez persuades it too, or it was processing the state_entry() event when returned to the inventory.
- NO state_exit run? - if on_rez changes states then it will run, but not of itself.
- YES Permissions still valid? - at the moment, this might be changing in 1.9.
- N/A Execution suspends? (N/A because wasn't already running)

Object gets "taken"

Objects in inventory are suspended. They, in effect don't have a running script (no time given to the script) so your comments are odd. Listens and XMLRPC will NOT fire, the script is suspended.

Object has a copy taken (the original)
- NO Script variables reset?
- NO UUID changed?
- YES Listeners still valid?
- YES XMLRPC Com Channel still valid?
- NO Script State reset to default?
- NO on_rez run?
- NO state_entry run?
- NO state_exit run?
- YES Permissions still valid?
- NO Execution suspends?

Object has a copy taken (the copy)
- YES Script variables reset?
- YES UUID changed?
- ?? Listeners still valid? - probably, but it depends on the script.
- ?? XMLRPC Com Channel still valid? - no, the channel key is script dependant.
- ?? Script State reset to default? - yes
- NO on_rez run?
- NO state_entry run? - I'd expect it to.
- NO state_exit run?
- YES Permissions still valid? - I doubt it, but maybe.
- YES Execution suspends?

A script in an object is edited & recompiled.
- ?? Script variables reset? - absolutely yes
- NO UUID changed?
- ?? Listeners still valid? - Of course not, but could be restarted.
- ?? XMLRPC Com Channel still valid? - No
- ?? Script State reset to default? - Yes
- NO on_rez run?
- ?? state_entry run? - Yes
- ?? state_exit run? - only if called somehow
- ?? Permissions still valid? - no way.
- ?? Execution suspends? - No, execution is "killed" not suspended - there's no way back.

A script in an object is reset.
- YES Script variables reset?
- NO UUID changed?
- NO Listeners still valid?
- NO XMLRPC Com Channel still valid?
- YES Script State reset to default?
- NO on_rez run?
- YES state_entry run?
- ?? state_exit run? No
- ?? Permissions still valid? No - permissions are a script variable really.
- NO Execution suspends?

A script in an attachment when the user logs out.
- ?? Script variables reset? No
- ?? UUID changed? No, it ceases to exist
- ?? Listeners still valid? Not really -
- ?? XMLRPC Com Channel still valid?
- ?? Script State reset to default? No
- ?? on_rez run? No
- ?? state_entry run? No
- ?? state_exit run?
- ?? Permissions still valid? not relevant, but they will be when the persons logs back in
- ?? Execution suspends? yes

A script in an attachment when the user crosses sim boundries.
- ?? Script variables reset? No
- ?? UUID changed? No
- ?? Listeners still valid? Yes
- ?? XMLRPC Com Channel still valid?
- ?? Script State reset to default? No
- ?? on_rez run? No
- ?? state_entry run? No
- ?? state_exit run? No
- ?? Permissions still valid? For the person wearing the attachment, yes, for others no
- ?? Execution suspends? No (or not noticably, their might be a brief suspension during hand-off but it restarts.

A script in an attachment when the user teleports & gets the loading screen..
- ?? Script variables reset? No
- ?? UUID changed? Yes, at the moment
- ?? Listeners still valid? Yes
- ?? XMLRPC Com Channel still valid?
- ?? Script State reset to default? No
- ?? on_rez run? Yes, at the moment
- ?? state_entry run? No
- ?? state_exit run? No
- ?? Permissions still valid? Hmm, not sure, I think so for the wearer, but good scripting would have them automatically granted for the wearer anyway.
- ?? Execution suspends? Probably, but it's restarted.
Sparky Brewster
Registered User
Join date: 16 Feb 2006
Posts: 6
03-01-2006 09:47
From: Eloise Pasteur
There's too much here to deal with all at once, so I'll do a bit -


I agree 100% :) I was hoping a bunch of people would pick a would pick a couple small parts. Thanks for doing that!


From: someone
NO UUID changed? - wrong. Rerezzing DEFINITELY issues a new key.


Would this change if the person didn't have copy permissions?

From: someone

Objects in inventory are suspended. They, in effect don't have a running script (no time given to the script) so your comments are odd. Listens and XMLRPC will NOT fire, the script is suspended.


I didn't mean the script would get any processing time by listing listeners and XMLRPC. But lets say I take it, then rez it again. Would the act of taking it already have cleared those listeners and the XMLRPC channel? I wonder if having copy perms would make a difference here as well.

From: someone

Object has a copy taken (the copy)
- ?? Listeners still valid? - probably, but it depends on the script.


How might it depend on the script?

From: someone

A script in an attachment when the user logs out.
- ?? UUID changed? No, it ceases to exist


Ceases to exist in-grid. But upon next login, it won't change, right?

From: someone

- ?? Listeners still valid? Not really -


I think this is another case like above, I worded what I meant poorly. If a script is listening and the person logs out. Will that act clear the listeners, so next time they log back in the listeners won't be working?

Thank you!!!