Difference between revisions of "Attach"

From Second Life Wiki
Jump to navigation Jump to search
(child prims)
Line 37: Line 37:
{{LSL DefineRow|{{LSLGC|Attachment}}}}
{{LSL DefineRow|{{LSLGC|Attachment}}}}
|also_footer
|also_footer
|notes
|notes=In child prims the attach(NULL_KEY) event is only executed directly if the object is dropped into the world. It is not executed on normal detaching but delayed until the object is attached again.
|mode
|mode
|deprecated
|deprecated

Revision as of 15:44, 8 March 2009

Description

Event: attach( key id ){ ; }

Triggered in an object when the 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. 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 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>

Notes

In child prims the attach(NULL_KEY) event is only executed directly if the object is dropped into the world. It is not executed on normal detaching but delayed until the object is attached again.

See Also

Functions

• llAttachToAvatar
• llDetachFromAvatar
• llGetAttached

Articles

• Attachment

Deep Notes

Signature

event void attach( key id );