Difference between revisions of "State"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
{{LSL Header| | {{LSL Header| | ||
}}{{#vardefine:name| | }}{{#vardefine:name|state | ||
}}{{#vardefine: | }}{{#vardefine:p_jump_state_desc|name of a state to run | ||
}}{{#vardefine: | }}{{#vardefine:p_label_state_desc|state name | ||
}}{{#vardefine:header_title| | }}{{#vardefine:p_events_desc|one or more events | ||
}}{{#vardefine:header_title|state {{LSL Param|jump_state|target}}; | |||
}}{{#vardefine:header_text|{{{!}} | }}{{#vardefine:header_text|{{{!}} | ||
{{LSL DefineRow|label|target|{{#var: | {{LSL DefineRow|label|target|{{#var:p_jump_state_desc}}}} | ||
{{!}}} | {{!}}} | ||
Causes the script to exit the current state (and triggering the [[state_exit]] if it exists) and enter the state '''target'''. If the old state and the new state are the same state, neither the [[state_entry]] or [[state_exit]] are queued. | |||
}}{{#vardefine:constants_nb| | }}{{#vardefine:constants_nb| | ||
<div id="box"> | <div id="box"> | ||
<h2> | <h2>state {{LSL Param|label_state|target}}{ {{LSL Param|events}} }</h2> | ||
<div style="padding: 0.5em"> | <div style="padding: 0.5em"> | ||
{{{!}} | {{{!}} | ||
{{LSL DefineRow|label|target|{{#var: | {{LSL DefineRow|label|target|{{#var:p_label_state_desc}}}} | ||
{{LSL DefineRow|event|events|{{#var:p_events_desc}}}} | |||
{{!}}} | {{!}}} | ||
State definition. | |||
</div> | </div> | ||
</div> | </div> | ||
}}{{#vardefine:examples| | }}{{#vardefine:examples| | ||
<pre> | <pre> | ||
state hello | |||
{ | |||
state_entry() | |||
{ | |||
llOwnerSay("Hello"); | |||
llOwnerSay( | state default; | ||
} | |||
state_exit() | |||
{ | |||
llOwnerSay("Goodbye"); | |||
} | |||
} | |||
default | |||
{ | |||
touch_start(integer a) | |||
{ | |||
state hello; | |||
} | |||
} | |||
</pre> | </pre> | ||
}}{{#vardefine:notes| | }}{{#vardefine:notes| | ||
Line 33: | Line 48: | ||
}}{{#vardefine:also_header|<h3>Keywords</h3> | }}{{#vardefine:also_header|<h3>Keywords</h3> | ||
{{{!}} | {{{!}} | ||
{{LSL DefineRow||[[jump]]|}} | |||
{{LSL DefineRow||[[return]]|}} | {{LSL DefineRow||[[return]]|}} | ||
{{!}}} | {{!}}} | ||
}}{{#vardefine:also_footer| | }}{{#vardefine:also_footer| |
Revision as of 13:22, 2 March 2007
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
- The correct title of this article is state. The initial letter is shown capitalized due to technical restrictions.
state target;
state target;• label | target | – | name of a state to run |
Causes the script to exit the current state (and triggering the state_exit if it exists) and enter the state target. If the old state and the new state are the same state, neither the state_entry or state_exit are queued.
state target{ events }
• label | target | – | state name | |
• event | events | – | one or more events |
State definition.
Examples
state hello { state_entry() { llOwnerSay("Hello"); state default; } state_exit() { llOwnerSay("Goodbye"); } } default { touch_start(integer a) { state hello; } }