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
I was hoping a bunch of people would pick a would pick a couple small parts. Thanks for doing that!