Difference between revisions of "LlResetScript"

From Second Life Wiki
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:
{{LSLFunctionAll|func_id=163|func_sleep=0.0|func_energy=10.0|func=llResetScript|func_footnote=Resets the script|return_text|spec|caveats|examples|helpers|related|also|notes}}[[Category:LSL_Functions]][[Category:LSL_Stub]]
{{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

Summary

Function: llResetScript( );

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.

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()
    {
        ;
    }
}

See Also

Functions

Deep Notes

Search JIRA for related Issues

Signature

function void llResetScript();