Difference between revisions of "Attach"

From Second Life Wiki
Jump to navigation Jump to search
m
Line 14: Line 14:
The following is a simplified example of the attach event. As explained above the variable id will be the key of the avatar the scripted object is attached to otherwise it will take on the value of {{LSL_Constant/NULL_KEY}}. The conditional [[if]] statement is used to determine if the value of the variable id.
The following is a simplified example of the attach event. As explained above the variable id will be the key of the avatar the scripted object is attached to otherwise it will take on the value of {{LSL_Constant/NULL_KEY}}. The conditional [[if]] statement is used to determine if the value of the variable id.


<pre>default
<lsl>default
{   
{   
     attach(key id)
     attach(key id)
Line 27: Line 27:
         }
         }
     }
     }
}</pre>
}</lsl>
|helpers
|helpers
|also_header
|also_header

Revision as of 19:30, 29 December 2007

Description

Event: attach( key id ){ ; }

Triggered when an object attaches or detaches from agent.

• key id the avatar if attached, if not attached NULL_KEY.

Examples

The following is a simplified example of the attach event. As explained above the variable id will be the key of the avatar the scripted object is attached to otherwise it will take on the value of NULL_KEY. The conditional if statement is used to determine if the value of the variable id.

<lsl>default {

   attach(key id)
   {
       if(id)//tests if it is a valid key and not NULL_KEY
       {
           llSay(PUBLIC_CHANNEL,"I have been attached!");
       }
       else
       {
           llSay(PUBLIC_CHANNEL,"I have been detached!");
       }
   }

}</lsl>

See Also

Functions

• llAttachToAvatar
• llDetachFromAvatar
• llGetAttached

Articles

• Attachment

Deep Notes

Signature

event void attach( key id );