Difference between revisions of "State"

From Second Life Wiki
Jump to navigation Jump to search
Line 44: Line 44:
</pre>
</pre>
}}{{#vardefine:notes|
}}{{#vardefine:notes|
}}{{#vardefine:caveats|
}}{{#vardefine:caveats|*On state change all [[listen]]s are released.
}}{{#vardefine:helpers|
}}{{#vardefine:helpers|
}}{{#vardefine:also_header|<h3>Keywords</h3>
}}{{#vardefine:also_header|<h3>Keywords</h3>

Revision as of 22:37, 2 March 2007

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.

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

Keywords

•  jump
•  return