Difference between revisions of "Attach"

From Second Life Wiki
Jump to navigation Jump to search
m (Trying to fix Attach showing up under the "S". (Part 2 of 2))
Line 5: Line 5:
|p1_type=key
|p1_type=key
|p1_name=id
|p1_name=id
|p1_desc=the avatar if attached, if not attached {{LSL Const|NULL_KEY}}.
|p1_desc=the avatar if attached, if not attached {{LSL_Constant/NULL_KEY}}.
|p1_hover=the avatar if attached, if not attached NULL_KEY.
|event_desc=Triggered when an object attaches or detaches from agent.
|event_desc=Triggered when an object attaches or detaches from agent.
|constants
|constants
Line 11: Line 12:
|caveats
|caveats
|examples=
|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 {{LSL Const|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
<pre>default
Line 30: Line 31:
|also_header
|also_header
|also_events
|also_events
|also_functions={{LSL DefineRow|[[llAttachToAvatar]]}}
|also_functions=
{{LSL DefineRow|[[llAttachToAvatar]]}}
{{LSL DefineRow|[[llDetachFromAvatar]]}}
{{LSL DefineRow|[[llDetachFromAvatar]]}}
{{LSL DefineRow|[[llGetAttached]]}}
{{LSL DefineRow|[[llGetAttached]]}}
|also_articles={{LSL DefineRow|{{LSLGC|Attachment}}}}
|also_articles=
{{LSL DefineRow|{{LSLGC|Attachment}}}}
|also_footer
|also_footer
|notes
|notes

Revision as of 08:39, 12 November 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.

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

See Also

Functions

• llAttachToAvatar
• llDetachFromAvatar
• llGetAttached

Articles

• Attachment

Deep Notes

Signature

event void attach( key id );