LlAttachToAvatar
| 首页 | 函数 | 事件 | 类型 | 操作符 | 常数 | Flow Control | Script Library | Categorized Library | Tutorials |
| 函数名 |
|---|
| 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) |
| 相关事件 |
|---|
| 无 |