Difference between revisions of "State exit"

From Second Life Wiki
Jump to navigation Jump to search
m (+ caveat)
Line 13: Line 13:
     }
     }
     touch_start(integer detected)
     touch_start(integer detected)
    {
        //Do NOT trigger change state here. See NOTES (2)
    }
    touch_end(integer detected)
     {
     {
         state other;
         state other;
Line 29: Line 33:
     }
     }
     touch_start(integer detected)
     touch_start(integer detected)
    {
        //Do NOT trigger change state here. See NOTES (2)
    }
    touch_end(integer detected)
     {
     {
         state default;
         state default;
Line 43: Line 51:
|also_articles
|also_articles
|also_footer
|also_footer
|notes=While the [[default]] [[state_entry]] is triggered on script reset, state_exit is not triggered prior to the reset.
|notes=
* (1) While the [[default]] [[state_entry]] is triggered on script reset, state_exit is not triggered prior to the reset.
* (2) Do not change states from within the touch_start() event, since this will prevent the touch_end() event
being called even if you did not define it and from this preserve a partial solve touch event chain across
state transitions.
To perform state transitions at a "touch" make use of the touch_end() event instead!
See: [[SVC-3017]][c]
|mode
|mode
|deprecated
|deprecated

Revision as of 21:27, 30 January 2010

Description

Event: state_exit( ){ ; }

Triggered on a qualifying state transition.


Caveats

  • Events queued during state_exit, are dumped before the next state is entered. use state_entry to avoid this, when possible. See state for further caveats.
All Issues ~ Search JIRA for related Bugs

Examples

<lsl>default {

   state_entry()
   {
       llOwnerSay("in default state");
   }
   touch_start(integer detected)
   {
        //Do NOT trigger change state here. See NOTES (2)
   }
   touch_end(integer detected)
   {
       state other;
   }
   state_exit()
   {
       llOwnerSay("leaving default state");
   }

}

state other {

   state_entry()
   {
       llOwnerSay("in state \"other\"");
   }
   touch_start(integer detected)
   {
       //Do NOT trigger change state here. See NOTES (2)
   }
   touch_end(integer detected)
   {
       state default;
   }
   state_exit()
   {
       llOwnerSay("leaving state \"other\"");
   }

}</lsl>

Notes

  • (1) While the default state_entry is triggered on script reset, state_exit is not triggered prior to the reset.
  • (2) Do not change states from within the touch_start() event, since this will prevent the touch_end() event

being called even if you did not define it and from this preserve a partial solve touch event chain across state transitions. To perform state transitions at a "touch" make use of the touch_end() event instead! See: SVC-3017[c]

Deep Notes

Signature

event void state_exit(  );