llDetachFromAvatar
llDetachFromAvatar();- Energy
- 10
- Permission
PERMISSION_ATTACH
Detaches the object containing the script from the avatar. Requires the PERMISSION_ATTACH runtime permission (automatically granted to attached objects). Note that the detached object is completely removed from the region and not dropped on the ground.
Detach object from avatar.
The detached object is no longer present in the sim. There is no lsl equivilent of the “Drop” command that moves an attachment onto the ground. Use llRezObject if you need similar behavior
llDetachFromAvatar();Caveats
Section titled “Caveats”- Only works in the root prim of the attachment; calling it from a script in a child prim will cause it to fail silently.
- If the attachment was attached using
llAttachToAvatarTemp, theattach() event will not be called because the object will be destroyed before the event gets processed.
Examples
Section titled “Examples”Example 1
18 collapsed lines
default{ attach(key AvatarKey) {//give instructions for use and prevent item from being attached to avatar if(AvatarKey) {//event is called on both attach and detatch, but Key is only valid on attach llOwnerSay (" We hope you will enjoy your purchase, but if you really want to use this item properly, you should: 1) drag it from your inventory to the ground 2) Right click on it and select \"open\" 3) copy its contents to inventory.");
llRequestPermissions(AvatarKey, PERMISSION_ATTACH ); } } run_time_permissions(integer perm) { if(perm & PERMISSION_ATTACH) { llDetachFromAvatar( ); } }}There is no way to delete an attachment with a script or to drop it to the ground.
Known issues
Section titled “Known issues”- VWR-12525:
llAttachToAvatar() can cause parentless attachments that can subsequently crash the client when selected - VWR-16294: When using
llDetachFromAvatarafter teleport the objects still appears attached to the user but not to other residents and becomes almost impossible to detatch.
See also
Section titled “See also”Functions
Section titled “Functions”Events
Section titled “Events”Original wiki source
Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.