Difference between revisions of "Default"

From Second Life Wiki
Jump to navigation Jump to search
(Redirecting to State)
Line 1: Line 1:
{{LSL Header|
#REDIRECT [[State]]
}}{{#vardefine:name|default
}}{{#vardefine:p_events_desc|one or more {{LSLGC|Events|events}}
}}{{#vardefine:header_title|default { {{LSL Param|events}} }
}}{{#vardefine:header_text|{{{!}}
{{LSL DefineRow|event|events|{{#var:p_events_desc}}}}
{{!}}}
default state definition.
When a ''state target;'' is encountered at runtime, if the ''current'' state and the ''target'' state are different:
#Trigger [[state_exit]] in the current state if it exists and clear the event queue.
#Change state to ''target'', any [[listen]]s are unregistered.
#Trigger [[state_entry]] in the ''target'' state if it exists.
If ''target'' state is the same as the ''current'' state, no state change occurs nor do any of the side effects.
}}{{#vardefine:constants_nb|
}}{{#vardefine:examples|
<pre>
default
{
    touch_start(integer a)
    {
        state hello;
    }
}
 
state hello
{
    state_entry()
    {
        llOwnerSay("Hello");
        state default;
    }
    state_exit()
    {
        llOwnerSay("Goodbye");
    }
}
</pre>
}}{{#vardefine:notes|
}}{{#vardefine:caveats|*On state change all [[listen]]s are released.
}}{{#vardefine:helpers|
}}{{#vardefine:also_header|<h3>Keywords</h3>
{{{!}}
{{LSL DefineRow||[[state]]|}}
{{LSL DefineRow||[[jump]]|}}
{{LSL DefineRow||[[return]]|}}
{{!}}}
}}{{#vardefine:also_footer|
}}{{#vardefine:also_functions|
}}{{#vardefine:also_events|
{{LSL DefineRow||[[state_entry]]|}}
{{LSL DefineRow||[[state_exit]]|}}
}}{{#vardefine:also_articles|
}}{{#vardefine:also_tests|
}}{{#vardefine:location|
}}{{LSL Generic}}{{LSLC|Flow Control}}{{LSLC|Script}}

Revision as of 21:31, 5 March 2007

Redirect to: