Skip to content
lsl.devlsl.devLSL Dev

LlDetachFromAvatar

Looking for the current API? Open the llDetachFromAvatar reference →

Wiki description

Detach object from avatar.

Function notes

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

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, the attach() event will not be called because the object will be destroyed before the event gets processed.

Examples

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( );
        }
    }
}

Notes

There is no way to delete an attachment with a script or to drop it to the ground.

See also: functions

See also: events

Known issues

Additional wiki content

LSL Function/permission: {{LSL_Function/permission|PERMISSION_ATTACH|grant=the owner}}
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.