<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.osgrid.org/index.php?action=history&amp;feed=atom&amp;title=LlAttachToAvatar</id>
	<title>LlAttachToAvatar - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.osgrid.org/index.php?action=history&amp;feed=atom&amp;title=LlAttachToAvatar"/>
	<link rel="alternate" type="text/html" href="http://wiki.osgrid.org/index.php?title=LlAttachToAvatar&amp;action=history"/>
	<updated>2026-10-25T11:50:18Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>http://wiki.osgrid.org/index.php?title=LlAttachToAvatar&amp;diff=64&amp;oldid=prev</id>
		<title>Osgridadmin: /* Function: llAttachToAvatar( integer attachment ); */</title>
		<link rel="alternate" type="text/html" href="http://wiki.osgrid.org/index.php?title=LlAttachToAvatar&amp;diff=64&amp;oldid=prev"/>
		<updated>2017-12-30T16:00:58Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Function: llAttachToAvatar( integer attachment );&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Function: llAttachToAvatar( integer attachment );==&lt;br /&gt;
Attaches the object to the avatar who has granted permission to the script. The object is taken into the users inventory and attached to the attach point attachment.&amp;lt;br&amp;gt;&lt;br /&gt;
• integer 	attachment 	– 	ATTACH_* constant or valid value (see the tables below) 	&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Requires the PERMISSION_ATTACH permission, granted by the owner, to run.&amp;lt;br&amp;gt;&lt;br /&gt;
If attachment is zero, then the object attaches to the attach point it was most recently attached to.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
| &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;.5&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! bgcolor=&amp;quot;black&amp;quot; colspan=&amp;quot;2&amp;quot; | &amp;lt;span style=&amp;quot;color:#CC6633&amp;quot;&amp;gt;Constant !! bgcolor=&amp;quot;black&amp;quot; style=&amp;quot;text-align:center| &amp;lt;span style=&amp;quot;color:#CC6633&amp;quot;&amp;gt;Comment&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[LINK_ROOT]] || style=&amp;quot;text-align:center&amp;quot;| 1 || style=&amp;quot;text-align:left&amp;quot; | sends to root prim in a linked set &lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_HEAD]] || style=&amp;quot;text-align:center&amp;quot;| 2 || style=&amp;quot;text-align:left&amp;quot; | head&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_LSHOULDER]] || style=&amp;quot;text-align:center&amp;quot;| 3 || style=&amp;quot;text-align:left&amp;quot; | left shoulder&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_RSHOULDER]] || style=&amp;quot;text-align:center&amp;quot;| 4 || style=&amp;quot;text-align:left&amp;quot; | right shoulder&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_LHAND]] || style=&amp;quot;text-align:center&amp;quot;| 5 || style=&amp;quot;text-align:left&amp;quot; | left hand&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_RHAND]] || style=&amp;quot;text-align:center&amp;quot;| 6 || style=&amp;quot;text-align:left&amp;quot; | right hand &lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_LFOOT]] || style=&amp;quot;text-align:center&amp;quot;| 7 || style=&amp;quot;text-align:left&amp;quot; | left foot&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_RFOOT]] || style=&amp;quot;text-align:center&amp;quot;| 8 || style=&amp;quot;text-align:left&amp;quot; | right foot &lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_BACK]] || style=&amp;quot;text-align:center&amp;quot;| 9 || style=&amp;quot;text-align:left&amp;quot; | back&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_PELVIS]] || style=&amp;quot;text-align:center&amp;quot;| 10 || style=&amp;quot;text-align:left&amp;quot; | pelvis &lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_MOUTH]] || style=&amp;quot;text-align:center&amp;quot;| 11 || style=&amp;quot;text-align:left&amp;quot; | mouth &lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_CHIN]] || style=&amp;quot;text-align:center&amp;quot;| 12 || style=&amp;quot;text-align:left&amp;quot; | chin &lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_LEAR]] || style=&amp;quot;text-align:center&amp;quot;| 13 || style=&amp;quot;text-align:left&amp;quot; | left ear &lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_REAR]] || style=&amp;quot;text-align:center&amp;quot;| 14 || style=&amp;quot;text-align:left&amp;quot; | right ear&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_LEYE]] || style=&amp;quot;text-align:center&amp;quot;| 15 || style=&amp;quot;text-align:left&amp;quot; | left eye &lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_REYE]] || style=&amp;quot;text-align:center&amp;quot;| 16 || style=&amp;quot;text-align:left&amp;quot; | right eye&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_NOSE]] || style=&amp;quot;text-align:center&amp;quot;| 17 || style=&amp;quot;text-align:left&amp;quot; | nose&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_RUARM]] || style=&amp;quot;text-align:center&amp;quot;| 18 || style=&amp;quot;text-align:left&amp;quot; | right upper arm&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_RLARM]] || style=&amp;quot;text-align:center&amp;quot;| 19 || style=&amp;quot;text-align:left&amp;quot; | right lower arm &lt;br /&gt;
|}&lt;br /&gt;
| &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;.5&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! bgcolor=&amp;quot;black&amp;quot; colspan=&amp;quot;2&amp;quot; | &amp;lt;span style=&amp;quot;color:#CC6633&amp;quot;&amp;gt;Constant !! bgcolor=&amp;quot;black&amp;quot; style=&amp;quot;text-align:center| &amp;lt;span style=&amp;quot;color:#CC6633&amp;quot;&amp;gt;Comment&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_LUARM]] || style=&amp;quot;text-align:center&amp;quot;| 20 || style=&amp;quot;text-align:left&amp;quot; | left upper arm &lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_LLARM]] || style=&amp;quot;text-align:center&amp;quot;| 21 || style=&amp;quot;text-align:left&amp;quot; | left lower arm&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_RHIP]] || style=&amp;quot;text-align:center&amp;quot;| 22 || style=&amp;quot;text-align:left&amp;quot; | right hip &lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_RULEG]] || style=&amp;quot;text-align:center&amp;quot;| 23 || style=&amp;quot;text-align:left&amp;quot; | right upper leg&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_RLLEG]] || style=&amp;quot;text-align:center&amp;quot;| 24 || style=&amp;quot;text-align:left&amp;quot; | right lower leg &lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_LHIP]] || style=&amp;quot;text-align:center&amp;quot;| 25 || style=&amp;quot;text-align:left&amp;quot; | left hip&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_LULEG]] || style=&amp;quot;text-align:center&amp;quot;| 26 || style=&amp;quot;text-align:left&amp;quot; | left upper leg &lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_LLLEG]] || style=&amp;quot;text-align:center&amp;quot;| 27 || style=&amp;quot;text-align:left&amp;quot; | left lower leg&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_BELLY]] || style=&amp;quot;text-align:center&amp;quot;| 28 || style=&amp;quot;text-align:left&amp;quot; | belly/stomach/tummy &lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| &amp;lt;strike&amp;gt;ATTACH_RPEC&amp;lt;/strike&amp;gt; || style=&amp;quot;text-align:center&amp;quot;| 29 || style=&amp;quot;text-align:left&amp;quot; | left pectoral &lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| &amp;lt;strike&amp;gt;ATTACH_LPEC&amp;lt;/strike&amp;gt; || style=&amp;quot;text-align:center&amp;quot;| 30 || style=&amp;quot;text-align:left&amp;quot; | right pectoral&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_HUD_CENTER_2]] || style=&amp;quot;text-align:center&amp;quot;| 31 || style=&amp;quot;text-align:left&amp;quot; | HUD Center 2&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_HUD_TOP_RIGHT]] || style=&amp;quot;text-align:center&amp;quot;| 32 || style=&amp;quot;text-align:left&amp;quot; | HUD Top Right&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_HUD_TOP_CENTER]] || style=&amp;quot;text-align:center&amp;quot;| 33 || style=&amp;quot;text-align:left&amp;quot; | HUD Top &lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_HUD_TOP_LEFT]] || style=&amp;quot;text-align:center&amp;quot;| 34 || style=&amp;quot;text-align:left&amp;quot; | HUD Top Left &lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_HUD_CENTER_1]] || style=&amp;quot;text-align:center&amp;quot;| 35 || style=&amp;quot;text-align:left&amp;quot; | HUD Center &lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_HUD_BOTTOM_LEFT]] || style=&amp;quot;text-align:center&amp;quot;| 36 || style=&amp;quot;text-align:left&amp;quot; | HUD Bottom Left &lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_HUD_BOTTOM]] || style=&amp;quot;text-align:center&amp;quot;| 37 || style=&amp;quot;text-align:left&amp;quot; | HUD Bottom &lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align:left&amp;quot;| [[ATTACH_HUD_BOTTOM_RIGHT]] || style=&amp;quot;text-align:center&amp;quot;| 38 || style=&amp;quot;text-align:left&amp;quot; | HUD Bottom Right&lt;br /&gt;
|}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Caveats&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
•  Do not depend upon the auto-grant status of permissions. Always use the run_time_permissions event.&amp;lt;br&amp;gt;&lt;br /&gt;
•  If the script lacks the permission PERMISSION_ATTACH, the script will shout an error on DEBUG_CHANNEL and the operation fails (but the script continues to run).&amp;lt;br&amp;gt;&lt;br /&gt;
•  If PERMISSION_ATTACH is granted by anyone other than the owner, then when the function is called an error will be shouted on DEBUG_CHANNEL.&amp;lt;br&amp;gt;&lt;br /&gt;
•  Once the PERMISSION_ATTACH permission is granted there is no way to revoke it. The script will only lose the permission if it is reset or the object derezzed (deleted, detached, or taken).&amp;lt;br&amp;gt;&lt;br /&gt;
•  The call will fail if the avatar is not the owner of the object being attached, even if PERMISSION_ATTACH has been properly granted.&amp;lt;br&amp;gt;&lt;br /&gt;
•  Two objects cannot be attached to the same attachment point at the same time.&lt;br /&gt;
•  Objects attached to the head (and any attachment position within the head) will not be visible in First Person view (aka Mouselook) if &amp;quot;show attachments in mouselook&amp;quot; is disable.&amp;lt;br&amp;gt;&lt;br /&gt;
•  If attachment is zero but the object was never previously attached, it defaults to the right hand (ATTACH_RHAND). &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Examples&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;source lang=&amp;quot;lsl&amp;quot;&amp;gt;&lt;br /&gt;
//-- rez object on ground, drop in this script, it will request permissions to attach,&lt;br /&gt;
//-- and then attach to the left hand if permission is granted. if permission is denied,&lt;br /&gt;
//-- then the script complains.&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestPermissions( llGetOwner(), PERMISSION_ATTACH );&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    run_time_permissions( integer vBitPermissions )&lt;br /&gt;
    {&lt;br /&gt;
        if (PERMISSION_ATTACH &amp;amp; vBitPermissions)&lt;br /&gt;
        {&lt;br /&gt;
            llAttachToAvatar( ATTACH_LHAND );&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llOwnerSay( &amp;quot;Permission to attach denied&amp;quot; );&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    on_rez(integer rez)&lt;br /&gt;
    {&lt;br /&gt;
        if(!llGetAttached())&lt;br /&gt;
        { //reset the script if it&amp;#039;s not attached.&lt;br /&gt;
            llResetScript();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    attach(key AvatarKey)&lt;br /&gt;
    {&lt;br /&gt;
        if(AvatarKey)&lt;br /&gt;
        {//event is called on both attach and detach, but Key is only valid on attach&lt;br /&gt;
            integer test = llGetAttached();&lt;br /&gt;
            if (test) {&lt;br /&gt;
                llOwnerSay( &amp;quot;The object is attached&amp;quot; );&lt;br /&gt;
            } else {&lt;br /&gt;
                llOwnerSay( &amp;quot;The object is not attached&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
See Also &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Events&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
•  	[[run_time_permissions]] 	– 	Permission receiving event 	 &amp;lt;br&amp;gt;&lt;br /&gt;
Functions &amp;lt;br&amp;gt;&lt;br /&gt;
•  	[[llGetPermissions]] 	– 	Get the permissions granted 	&amp;lt;br&amp;gt;&lt;br /&gt;
•  	[[llGetPermissionsKey]] 	– 	Get the agent who granted permissions 	&amp;lt;br&amp;gt;&lt;br /&gt;
•  	[[llRequestPermissions]] 	– 	Request permissions 	&amp;lt;br&amp;gt;&lt;br /&gt;
•  	[[llDetachFromAvatar]] 	– 	Detaches the object from the avatar 	&amp;lt;br&amp;gt;&lt;br /&gt;
•  	[[llGetAttached]] 	– 	Gets the attach point number 	&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Articles&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
•  	[[Script permissions]] 		&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Osgridadmin</name></author>
	</entry>
</feed>