States Concise
De DigiWiki.
This is a basic demonstration of how, in LSL, a script may change its state. I've purposefully omitted the use of GlobalVariables because, and this is one of the really nice things about the whole state concept, by structuring your code appropriately, you may infer things about the operating conditions of the task by what state it is in. --ChromalBrodsky
default { state_entry() { llWhisper(0, "Now in default state. *yawn*"); } touch_start( integer iTouched ) { state funky; } state_exit() { llWhisper(0, "Hey... I feel a little funny... Strange..."); } } state funky { state_entry() { llSay(0, "I'm in a FuNkY state!"); } touch_start( integer iTouched ) { state default; } state_exit() { llSay(0, "Aw, I'm starting to mellow, man..."); } }


