Changed Event Example

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m (Removed 'Template:' prefix from template includings and/or changed external-link into internal-link)
(Added source formatting. Page may need to be moved or deleted.)
Line 3: Line 3:
  
 
'''Code:'''
 
'''Code:'''
 +
<source lang = "lsl">
 
  default {
 
  default {
 
     state_entry() {
 
     state_entry() {
Line 19: Line 20:
 
     }
 
     }
 
  }
 
  }
 
+
</source>
  
 
[[Category:Scripts]]
 
[[Category:Scripts]]

Revision as of 12:47, 1 August 2011

Code:

default {
    state_entry() {
        llSitTarget(<0, 0, 0.1>, ZERO_ROTATION); // needed for llAvatarOnSitTarget to work
    }
 
    changed(integer change) { // something changed
        if ((change & CHANGED_LINK) != 0) { // and it was a link change
           // llSleep(0.5); // llUnSit works better with this delay
            key av = llAvatarOnSitTarget();
            if (av != "") { // somebody is sitting on me
                llSay(0, "Get off!"); // say in chat when person is remove from prim
 
            }
        }
    }
 }
Personal tools
General
About This Wiki