“LlSameGroup”的版本间的差异
(创建页面,内容为“{{LSL Header|ml=*}}{{LSLC|Keywords}}{{LSLC|Flow Control}}{{LSLC|}} {{函数详情 |函数名 = Function: integer llSameGroup( key uuid ); |参数= 参数:• key…”) |
(没有差异)
|
2020年8月18日 (二) 09:22的最新版本
| 首页 | 函数 | 事件 | 类型 | 操作符 | 常数 | Flow Control | Script Library | Categorized Library | Tutorials |
| 函数名 |
|---|
| Function: integer llSameGroup( key uuid ); |
| 参数:• key uuid – group, avatar or prim UUID that is in the same region |
| 返回值:如果uuid和脚本所在的prim属于同一组,则返回一个布尔值(整数),否则为FALSE。
这个函数将包含脚本的prim的组-uuid与uuid描述的组-uuid进行比较。它回答了两个问题: 脚本的prim是否与uuid在同一组? 脚本的prim的group-uuid是否等于uuid? |
| 注意事项 |
|---|
| 不太明显的是,如果对象没有设置为组(例如,它会返回TRUE)。"(none)"),并且具有给定键的AV没有组活动,或者使用NULL_KEY调用函数。
Specification
脚本所在的基本物体组是……
• 将基本物体组设为
• 原语所属的组
• 除此之外,基本物体组还归其所有
• 如果没有设置组信息,则为此使用的组uuid为NULL_KEY。
uuid的组为…
• 如果uuid是一个prim(已知的区域)…
• 它是一个附件,所有者的活动组*
• 将基本物体组设为
• 原语所属的组
• 除此之外,基本物体组还归其所有
• 如果没有设置组信息,则为此使用的组uuid为NULL_KEY。
• 如果uuid是一个avatar(该地区已知)…
• 化身的活跃组。
• 如果没有设置组信息,则为此使用的组uuid为NULL_KEY。
• 否则,将uuid视为组uuid。
• 这意味着不再执行“脚本的prim是否与uuid在同一组?”,而是执行“脚本的prim的group-uuid是否等于uuid?”
注意:没有组、prim或avatar共享相同的uuid。
在伪代码:
integer llSameGroup(key uuid){
key group = getGroupKey(llGetKey());
if(uuid == group)
return TRUE;
if(getGroupKey(uuid) == group)
return TRUE;
return FALSE;
} |
| 示例 |
|---|
示例1
//只将库存对象提供给具有相同活动组的代理
default
{
touch_start(integer total_number)
{
key id = llDetectedKey(0);
integer sameGroup = llSameGroup(id);
//同llDetectedGroup(i)(有llDetectedGroup,检测到的不需要在sim中)
if (sameGroup)
{
integer numberOfObjectsInPrim = llGetInventoryNumber(INVENTORY_OBJECT);
if (numberOfObjectsInPrim)
llGiveInventory(id, llGetInventoryName(INVENTORY_OBJECT, 0));
}
else
{
llRegionSayTo(id, 0, "Wrong active group!");
}
}
}
|
| 相关函数 |
|---|
| llDetectedGroup - 与检测事件一起使用
llGetAttachedList - 与llGetObjectDetails和OBJECT_GROUP一起,它可以用于确定佩戴至少一个非hud附件的avatar的活动组。 |
| 相关事件 |
|---|
| 无 |