Difference between revisions of "LlAttachToAvatarTemp"
Line 3: | Line 3: | ||
|func_desc = Follows the same convention as [[llAttachToAvatar]], with the exception that the object will not create new inventory for the user, and will disappear on detach or disconnect. | |func_desc = Follows the same convention as [[llAttachToAvatar]], with the exception that the object will not create new inventory for the user, and will disappear on detach or disconnect. | ||
|func_footnote = It should be noted that when an object is attached temporarily, a user cannot 'take' or 'drop' the object that is attached to them. | |func_footnote = It should be noted that when an object is attached temporarily, a user cannot 'take' or 'drop' the object that is attached to them. | ||
*Note that the user DOES NOT have to be the owner of the object for it to attach properly. In fact | *Note that the user DOES NOT have to be the owner of the object for it to attach properly. In fact giving the object, or having the user take the object, in order to transfer ownership, negates most of the usefulness of this function. | ||
|p1_type = integer | |p1_type = integer | ||
|p1_name = attach_point | |p1_name = attach_point |
Revision as of 19:35, 31 July 2012
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: llAttachToAvatarTemp( integer attach_point );Follows the same convention as llAttachToAvatar, with the exception that the object will not create new inventory for the user, and will disappear on detach or disconnect.
• integer | attach_point | – | ATTACH_* constant or valid value (see the tables below) |
It should be noted that when an object is attached temporarily, a user cannot 'take' or 'drop' the object that is attached to them.
- Note that the user DOES NOT have to be the owner of the object for it to attach properly. In fact giving the object, or having the user take the object, in order to transfer ownership, negates most of the usefulness of this function.
Note: Constants in italic require a viewer compatible with the Project Bento skeleton. |
|
|
Caveats
- Attach points can be occupied by multiple attachments.[1]
- This was not always the case, previously if attach_point was occupied, the existing object was detached and the new attachment took it's place.
- Objects attached to the head (and any attachment position within the head) will not be visible in First Person view (aka Mouselook) if "show attachments in mouselook" is disabled.
- If attach_point is zero but the object was never previously attached, it defaults to the right hand (ATTACH_RHAND).
- If the object is already attached the function fails silently, regardless if the attach_point is a different attach point.
Examples
<lsl>//-- rez object on ground, drop in this script, it will request permissions to attach, //-- and then attach to the left hand if permission is granted. if permission is denied, //-- then the script complains. default {
state_entry() { llRequestPermissions( llGetOwner(), PERMISSION_ATTACH ); }
run_time_permissions( integer vBitPermissions ) { if( vBitPermissions & PERMISSION_ATTACH ) { llAttachToAvatarTemp( ATTACH_LHAND ); } else { llOwnerSay( "Permission to attach denied" ); } }
on_rez(integer rez) { if(!llGetAttached()) { //reset the script if it's not attached. llResetScript(); } }
attach(key AvatarKey) { if(AvatarKey) {//event is called on both attach and detach, but Key is only valid on attach integer test = llGetAttached(); if (test) { llOwnerSay( "The object is attached" ); } else { llOwnerSay( "The object is not attached"); } } }
}</lsl>
<lsl>//-- This example can demonstrate ownership transfer of an object on a temporary basis using llAttachToAvatarTemp() //-- Whoever touches will be asked for permission to attach, and upon granting permission will have the item attach, //-- But not appear in Inventory. default {
touch_start(integer num_touches) { llRequestPermissions( llDetectedKey(0), PERMISSION_ATTACH ); }
run_time_permissions( integer vBitPermissions ) { if( vBitPermissions & PERMISSION_ATTACH ) { llAttachToAvatarTemp( ATTACH_LHAND ); } else { llOwnerSay( "Permission to attach denied" ); } }
on_rez(integer rez) { if(!llGetAttached()) { //reset the script if it's not attached. llResetScript(); } }}</lsl>
See Also
Functions
• | llDetachFromAvatar | – | Detaches the object from the avatar | |
• | llGetAttached | – | Gets the attach point number |