LlGetAttached - Second Life Wiki

LlGetAttached

From Second Life Wiki

Jump to: navigation, search

Contents

Summary

Function: integer llGetAttached( );

Returns the attach_point (an integer) the object is attached to or zero if it is either not attached or is pending detachment.

Constant Comment
ATTACH_CHEST 1 chest/sternum
ATTACH_HEAD 2 head
ATTACH_LSHOULDER 3 left shoulder
ATTACH_RSHOULDER 4 right shoulder
ATTACH_LHAND 5 left hand
ATTACH_RHAND 6 right hand
ATTACH_LFOOT 7 left foot
ATTACH_RFOOT 8 right foot
ATTACH_BACK 9 back
ATTACH_PELVIS 10 pelvis
ATTACH_MOUTH 11 mouth
ATTACH_CHIN 12 chin
ATTACH_LEAR 13 left ear
Constant Comment
ATTACH_REAR 14 right ear
ATTACH_LEYE 15 left eye
ATTACH_REYE 16 right eye
ATTACH_NOSE 17 nose
ATTACH_RUARM 18 right upper arm
ATTACH_RLARM 19 right lower arm
ATTACH_LUARM 20 left upper arm
ATTACH_LLARM 21 left lower arm
ATTACH_RHIP 22 right hip
ATTACH_RULEG 23 right upper leg
ATTACH_RLLEG 24 right lower leg
ATTACH_LHIP 25 left hip
ATTACH_LULEG 26 left upper leg
ATTACH_LLLEG 27 left lower leg
Constant Comment
ATTACH_BELLY 28 belly/stomach/tummy
ATTACH_LEFT_PEC 29 left pectoral
ATTACH_RIGHT_PEC 30 right pectoral
ATTACH_HUD_CENTER_2 31 HUD Center 2
ATTACH_HUD_TOP_RIGHT 32 HUD Top Right
ATTACH_HUD_TOP_CENTER 33 HUD Top
ATTACH_HUD_TOP_LEFT 34 HUD Top Left
ATTACH_HUD_CENTER_1 35 HUD Center
ATTACH_HUD_BOTTOM_LEFT 36 HUD Bottom Left
ATTACH_HUD_BOTTOM 37 HUD Bottom
ATTACH_HUD_BOTTOM_RIGHT 38 HUD Bottom Right
ATTACH_NECK 39 neck
ATTACH_AVATAR_CENTER 40 avatar center/root

Examples

default
{
    attach(key id)
    {
        if(id)//it's attached
        {
            if(llGetAttached() != ATTACH_LHAND)
            {
                llOwnerSay("Please attach me only to the left hand");
                llRequestPermissions(id, PERMISSION_ATTACH);
            }
        }
    }
    run_time_permissions(integer a)
    {
        if(a & PERMISSION_ATTACH)
            llDetachFromAvatar();
    }
}

This snippet will make a prim invisible when attached, but visible when rezzed unattached

    on_rez(integer p)
    {
        // !llGetAttached() has the value 0 when attached, and 1 when unattached
        llSetAlpha( !llGetAttached(), ALL_SIDES);
    }

See Also

Deep Notes

Search JIRA for related Issues

This article wasn't helpful for you? Maybe the related article at the LSL Wiki is able to bring enlightenment.