Don't click here unless you want to be banned.

LSL Wiki : llAttachToAvatar

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org
llAttachToAvatar(integer attachment)

Attaches the scripted object at the specified attachment point to the avatar it has PERMISSION_ATTACH for. Even though users other than the owner can grant this permission, attaching to them will fail with the message "Script trying to attach to someone other than owner!".

An object must have permission to attach itself. Call llGetPermissions to see if the object has the PERMISSION_ATTACH permission; if it doesn't, llRequestPermissions must first be called to request permissions from the user.

The attach event is called with the avatar's key.

Notes:

The attachment parameter can be one of the following constants (also integers):

Constant Value Comment
? 0 attach to last used attachment spot, like when you select Wear (default is right hand)
ATTACH_CHEST 1 chest/sternum - ATTACH_LBOOBIE and ATTACH_RBOOBIE don't exist, though there's ATTACH_RPEC and ATTACH_LPEC
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
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_LHIP 23 left hip
ATTACH_RULEG 24 right upper leg
ATTACH_RLLEG 25 right lower leg
ATTACH_LULEG 26 left upper leg
ATTACH_LLLEG 27 left lower leg
ATTACH_BELLY 28 belly/stomach/tummy
ATTACH_RPEC 29 right pectoral
ATTACH_LPEC 30 left pectoral - as noted above, ATTACH_RPEC and ATTACH_LPEC don't always look like they're attached to the right and left side of the chest, and will appear to float around a little.
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

Q: Does this have any purpose when attaching from inventory or only for attaching on a touch event or similar thing? Seems like going from inventory doesn't require PERMISSION_ATTACH either.
A: llAttachToAvatar is used for objects that already exist in-world. Objects in your inventory can be thought of as being in an inert, suspended state. They don't actually "exist" until you rez them.

Q: If I attach an object from inventory, will it have PERMISSION_ATTACH right away, or do I have to request it? And what about an object rezzed by an attached object? (For example, if I need to have an attached object rez a HUD element.)
A: You always must request permissions, but some permissions are auto-granted upon request for attachment or sit. BW


Example:
default {
    touch_start(integer num_detected) {
        llRequestPermissions(llDetectedKey(0), PERMISSION_ATTACH);
    }
    
    run_time_permissions(integer perm) {
        if (perm & PERMISSION_ATTACH)  {
            llAttachToAvatar(ATTACH_RHAND);
        }
    }
}



Q: Can an attachment go directly to another point on the body? i.e. from left hand to chest?
A: No.



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

Functions | Agent/Avatar | Attachment
There are 8 comments on this page. [Display comments/form]