Difference between revisions of "LlResetScript"
Jump to navigation
Jump to search
m (Specified what happens to timers/listeners) |
|||
(10 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{LSL_Function | ||
|func_id=163|func_sleep=0.0|func_energy=10.0 | |||
|func=llResetScript | |||
|func_footnote=On script reset... | |||
*The current event/function is exited without further execution or return. | |||
*Any granted URLs are released. | |||
*All global variables are set to their defaults. | |||
*Timers (including repeating sensors) are cleared. | |||
*Listeners are removed. | |||
*The event queue is cleared. | |||
*The [[default]] state is set as the active state. | |||
**If it has a [[state_entry]] event, then it is queued. | |||
|func_desc=Resets the script. | |||
|return_text | |||
|spec | |||
|caveats | |||
|constants | |||
|examples= | |||
<source lang="lsl2"> | |||
default | |||
{ | |||
// reset script when the object is rezzed | |||
on_rez(integer start_param) | |||
{ | |||
llResetScript(); | |||
} | |||
changed(integer change) | |||
{ | |||
// reset script when the owner or the inventory changed | |||
if (change & (CHANGED_OWNER | CHANGED_INVENTORY)) | |||
llResetScript(); | |||
} | |||
// script initialization here | |||
state_entry() | |||
{ | |||
; | |||
} | |||
} | |||
</source> | |||
|helpers | |||
|also_functions=*{{LSLG|llResetOtherScript}} | |||
|also_events | |||
|also_tests | |||
|also_articles | |||
|notes | |||
|permission | |||
|negative_index | |||
|sort=ResetScript | |||
|cat1=Script | |||
|cat2 | |||
|cat3 | |||
|cat4 | |||
}} |
Revision as of 12:45, 30 March 2020
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: llResetScript( );163 | Function ID |
0.0 | Forced Delay |
10.0 | Energy |
Resets the script.
On script reset...
- The current event/function is exited without further execution or return.
- Any granted URLs are released.
- All global variables are set to their defaults.
- Timers (including repeating sensors) are cleared.
- Listeners are removed.
- The event queue is cleared.
- The default state is set as the active state.
- If it has a state_entry event, then it is queued.
Caveats
Examples
default
{
// reset script when the object is rezzed
on_rez(integer start_param)
{
llResetScript();
}
changed(integer change)
{
// reset script when the owner or the inventory changed
if (change & (CHANGED_OWNER | CHANGED_INVENTORY))
llResetScript();
}
// script initialization here
state_entry()
{
;
}
}