“LlAttachToAvatar”的版本间的差异

来自人工智能助力教育知识百科
跳转至: 导航搜索
(创建页面,内容为“<nowiki>Body Constant # Name Comment ATTACH_HEAD 2 Skull head ATTACH_NOSE 17 Nose nose ATTACH_MOUTH 11 Mouth mouth ATTACH_FACE_TONGUE 52 Tongue tongue ATTACH_CHIN 12…”)
 
Kjf讨论 | 贡献
 
(未显示1个用户的2个中间版本)
第1行: 第1行:
<nowiki>Body
+
{{LSL Header|ml=*}}{{LSLC|Keywords}}{{LSLC|Flow Control}}{{LSLC|}}
Constant # Name Comment
+
 
ATTACH_HEAD 2 Skull head
+
 
ATTACH_NOSE 17 Nose nose
+
{{函数详情
ATTACH_MOUTH 11 Mouth mouth
+
|函数名 = Function: llAttachToAvatar( integer attach_point );
ATTACH_FACE_TONGUE 52 Tongue tongue
+
|参数 = 将对象附加到已授予脚本权限的化身。对象将被带入用户资源清册并附加到附加点。
ATTACH_CHIN 12 Chin chin
+
|返回值 = 整数附加点-附加常数或有效值(见下表)
ATTACH_FACE_JAW 47 Jaw jaw
+
要运行此函数,脚本必须使用llRequestPermissions请求权限附加权限,并且必须由所有者授予该权限。
ATTACH_LEAR 13 Left Ear left ear
+
如果附加点为零,则对象将附加到它最近附加到的附加点。
ATTACH_REAR 14 Right Ear right ear
+
 
ATTACH_FACE_LEAR 48 Alt Left Ear left ear (extended)
+
 
ATTACH_FACE_REAR 49 Alt Right Ear right ear (extended)
+
 
ATTACH_LEYE 15 Left Eye left eye
+
 
ATTACH_REYE 16 Right Eye right eye
+
|注意事项 = 权限
ATTACH_FACE_LEYE 50 Alt Left Eye left eye (extended)
+
不依赖于权限的自动授予状态。始终使用运行时权限事件。
ATTACH_FACE_REYE 51 Alt Right Eye right eye (extended)
+
如果脚本缺少权限附加,则脚本将在调试通道上喊出错误,操作将失败(但脚本将继续运行)。
ATTACH_NECK 39 Neck neck
+
如果所有者以外的任何人授予了权限附加,则当调用该函数时,将在调试通道上大喊错误。
ATTACH_LSHOULDER 3 Left Shoulder left shoulder
+
一旦授予了权限附加权限,除了从脚本内部(例如,使用新的llRequestPermissions调用)或脚本被重置或删除之外,无法撤消该权限。
ATTACH_RSHOULDER 4 Right Shoulder right shoulder
+
多个附件可以占用连接点。[1]
ATTACH_LUARM 20 L Upper Arm left upper arm
+
这并不总是这样,以前如果attach_point被占用,则现有对象被分离,而新的附件取代了它。
ATTACH_RUARM 18 R Upper Arm right upper arm
+
如果禁用“在Mouselook中显示附件”,则附加到头部的对象(以及头部内的任何附件位置)在第一人称视图(也称为Mouselook)中将不可见。
ATTACH_LLARM 21 L Lower Arm left lower arm
+
如果attach_point为零,但对象以前从未附加过,则默认为右手(attach_RHAND)。
ATTACH_RLARM 19 R Lower Arm right lower arm
+
如果对象已附加,则无论附加点是否是不同的附加点,函数都会自动失败。--可控硅-137
ATTACH_LHAND 5 Left Hand left hand
+
 
ATTACH_RHAND 6 Right Hand right hand
+
 
ATTACH_LHAND_RING1 41 Left Ring Finger left ring finger
+
|示例 =
ATTACH_RHAND_RING1 42 Right Ring Finger right ring finger
+
示例1
ATTACH_LWING 45 Left Wing left wing
+
<pre>  
ATTACH_RWING 46 Right Wing right wing
+
//-- rez object on ground, drop in this script, it will request permissions to attach,
ATTACH_CHEST 1 Chest chest/sternum
+
//-- and then attach to the left hand if permission is granted. if permission is denied,
ATTACH_LEFT_PEC 29 Left Pec left pectoral
+
//-- then the script complains.
ATTACH_RIGHT_PEC 30 Right Pec right pectoral
+
default
ATTACH_BELLY 28 Stomach belly/stomach/tummy
+
{
ATTACH_BACK 9 Spine back
+
    state_entry()
ATTACH_TAIL_BASE 43 Tail Base tail base
+
    {
ATTACH_TAIL_TIP 44 Tail Tip tail tip
+
        llRequestPermissions( llGetOwner(), PERMISSION_ATTACH );
ATTACH_AVATAR_CENTER 40 Avatar Center avatar center/root
+
    }
ATTACH_PELVIS 10 Pelvis pelvis
+
ATTACH_GROIN 53 Groin groin
+
    run_time_permissions( integer vBitPermissions )
ATTACH_LHIP 25 Left Hip left hip
+
    {
ATTACH_RHIP 22 Right Hip right hip
+
        if ( vBitPermissions & PERMISSION_ATTACH )    
ATTACH_LULEG 26 L Upper Leg left upper leg
+
            llAttachToAvatar( ATTACH_LHAND );   
ATTACH_RULEG 23 R Upper Leg right upper leg
+
        else   
ATTACH_RLLEG 24 R Lower Leg right lower leg
+
            llOwnerSay( "Permission to attach denied" );
ATTACH_LLLEG 27 L Lower Leg left lower leg
+
    }
ATTACH_LFOOT 7 Left Foot left foot
+
ATTACH_RFOOT 8 Right Foot right foot
+
    on_rez(integer rez)
ATTACH_HIND_LFOOT 54 Left Hind Foot left hind foot
+
    {
ATTACH_HIND_RFOOT 55 Right Hind Foot right hind foot
+
        if (!llGetAttached() )        //reset the script if it's not attached.
</nowiki>
+
            llResetScript();     
 +
    }
 +
 +
    attach(key id)
 +
    {
 +
        // The attach event is called on both attach and detach, but 'id' is only valid on attach
 +
        if (id)
 +
            llOwnerSay( "The object is attached to " + llKey2Name(id) );
 +
        else
 +
            llOwnerSay( "The object is not attached");
 +
    }
 +
}
 +
</pre>
 +
 
 +
 
 +
 
 +
|相关函数=
 +
[[llGetPermissions]]– Get the permissions granted
 +
 
 +
[[llGetPermissionsKey]] – Get the agent who granted permissions
 +
 
 +
[[llRequestPermissions]]– Request permissions
 +
 
 +
[[llAttachToAvatarTemp]]– Attach an object to any avatar but only temporarily
 +
 
 +
[[llDetachFromAvatar]] – Detaches the object from the avatar
 +
 
 +
[[llGetAttached]]– Gets the attach point number (that the object is attached to)
 +
 
 +
 
 +
文献:
 +
[[Script permissions]]
 +
}}

2021年8月16日 (一) 09:10的最新版本

Template:Needs Translation/


函数名
Function: llAttachToAvatar( integer attach_point );
将对象附加到已授予脚本权限的化身。对象将被带入用户资源清册并附加到附加点。
整数附加点-附加常数或有效值(见下表)

要运行此函数,脚本必须使用llRequestPermissions请求权限附加权限,并且必须由所有者授予该权限。 如果附加点为零,则对象将附加到它最近附加到的附加点。

注意事项
权限

不依赖于权限的自动授予状态。始终使用运行时权限事件。 如果脚本缺少权限附加,则脚本将在调试通道上喊出错误,操作将失败(但脚本将继续运行)。 如果所有者以外的任何人授予了权限附加,则当调用该函数时,将在调试通道上大喊错误。 一旦授予了权限附加权限,除了从脚本内部(例如,使用新的llRequestPermissions调用)或脚本被重置或删除之外,无法撤消该权限。 多个附件可以占用连接点。[1] 这并不总是这样,以前如果attach_point被占用,则现有对象被分离,而新的附件取代了它。 如果禁用“在Mouselook中显示附件”,则附加到头部的对象(以及头部内的任何附件位置)在第一人称视图(也称为Mouselook)中将不可见。 如果attach_point为零,但对象以前从未附加过,则默认为右手(attach_RHAND)。 如果对象已附加,则无论附加点是否是不同的附加点,函数都会自动失败。--可控硅-137

示例
示例1
 
//-- 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 )     
            llAttachToAvatar( 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 id)
    {
        // The attach event is called on both attach and detach, but 'id' is only valid on attach
        if (id)
            llOwnerSay( "The object is attached to " + llKey2Name(id) );
        else 
            llOwnerSay( "The object is not attached");
    }
}
相关函数
llGetPermissions– Get the permissions granted

llGetPermissionsKey – Get the agent who granted permissions

llRequestPermissions– Request permissions

llAttachToAvatarTemp– Attach an object to any avatar but only temporarily

llDetachFromAvatar – Detaches the object from the avatar

llGetAttached– Gets the attach point number (that the object is attached to)


文献: Script permissions

相关事件