Difference between revisions of "State"
Jump to navigation
Jump to search
Line 9: | Line 9: | ||
{{!}}}<br/> | {{!}}}<br/> | ||
When encountered at runtime, if the old state and the new state are different states: | When encountered at runtime, if the old state and the new state are different states: | ||
#Trigger [[state_exit]] in the current state if it exists. | #Trigger [[state_exit]] in the current state (if it exists) and clear the event queue. | ||
#Change state to '''target''' | #Change state to '''target''' | ||
#Trigger [[state_entry]] in the new state if it exists. | #Trigger [[state_entry]] in the new state if it exists. | ||
If not | If it is the same state, the event queue is left untouched (and [[state_entry]] & [[state_exit]] are not queued). | ||
}}{{#vardefine:constants_nb| | }}{{#vardefine:constants_nb| | ||
<div id="box"> | <div id="box"> | ||
Line 58: | Line 58: | ||
}}{{#vardefine:also_functions| | }}{{#vardefine:also_functions| | ||
}}{{#vardefine:also_events| | }}{{#vardefine:also_events| | ||
{{LSL DefineRow||[[state_entry]]|}} | |||
{{LSL DefineRow||[[state_exit]]|}} | |||
}}{{#vardefine:also_articles| | }}{{#vardefine:also_articles| | ||
}}{{#vardefine:also_tests| | }}{{#vardefine:also_tests| | ||
}}{{#vardefine:location| | }}{{#vardefine:location| | ||
}}{{LSL Generic}}{{LSLC|Flow Control}}{{LSLC|Script}} | }}{{LSL Generic}}{{LSLC|Flow Control}}{{LSLC|Script}} |
Revision as of 21:53, 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 |
When encountered at runtime, if the old state and the new state are different states:
- Trigger state_exit in the current state (if it exists) and clear the event queue.
- Change state to target
- Trigger state_entry in the new state if it exists.
If it is the same state, the event queue is left untouched (and state_entry & state_exit are not queued).
state target{ events }
• label | target | – | state name | |
• event | events | – | one or more events |
State definition.
Caveats
- On state change all listens are released.
Examples
state hello { state_entry() { llOwnerSay("Hello"); state default; } state_exit() { llOwnerSay("Goodbye"); } } default { touch_start(integer a) { state hello; } }
See Also