integer llGetAttached()

Returns the object’s attachment point (or 0 if not attached) to the avatar.

Valid values are:

0 Not attached
ATTACH_CHEST 1 chest (roughly the sternum)
ATTACH_HEAD 2 top of head (skull)
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 spine
ATTACH_PELVIS 10 pelvis
ATTACH_MOUTH 11 mouth
ATTACH_CHIN 12 chin
ATTACH_LEAR 13 left ear
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
ATTACH_BELLY 28 belly/stomach
ATTACH_RPEC 29 abdomen (right pectoral)
ATTACH_LPEC 30 abdomen (left pectoral)
31 HUD Center 2
32 HUD Top Right
33 HUD Top
34 HUD Top Left
35 HUD Center
36 HUD Bottom Left
37 HUD Bottom
38 HUD Bottom Right

 

Q: Can I use this to find out where a different object is attached?
A: No. You need to use a separate script in the other object for that.