State

From Second Life Wiki
Jump to navigation Jump to search
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:

  1. Trigger state_exit in the current state if it exists.
  2. Changes state to target
  3. Trigger state_entry in the new state if it exists.

If not, do nothing.

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