Difference between revisions of "Attach"

From Second Life Wiki
Jump to navigation Jump to search
(Added example of usage for attach event)
Line 10: Line 10:
|spec
|spec
|caveats
|caveats
|examples
|examples=
The following is a simplified example of the attach event. As explained above the varible 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 varible id.
 
default
  attach(key id)
  {
    [[if]](id != NULL_KEY)
    {
    [[llSay]](0,"I have been attached!")
    }
    else if(id == NULL_KEY)
    {
    [[llSay]](0,"I have been detached!")
    }
  }
}
 
|helpers
|helpers
|also_header
|also_header

Revision as of 13:56, 15 June 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.

Caveats


Examples

The following is a simplified example of the attach event. As explained above the varible 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 varible id.

default
{  
 attach(key id)
  {
   if(id != NULL_KEY)
   {
    llSay(0,"I have been attached!")
   }
   else if(id == NULL_KEY)
   {
    llSay(0,"I have been detached!")
   }
  }
}

Deep Notes

Signature

event void attach( key id );