查看“LlGetInventoryPermMask”的源代码
←
LlGetInventoryPermMask
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{LSL Header|ml=*}}{{LSLC|Keywords}}{{LSLC|Flow Control}}{{LSLC|}} {{函数详情 |函数名 = Function: integer llGetInventoryPermMask( string item, integer category ) |参数= 参数: *string item–an item in the inventory of the prim this script is in *integer category–MASK_* flag |返回值= 返回值:返回库存项的请求权限类别的位字段(整数) |注意事项= 注意事项 *如果项目从prim的库存中丢失,那么在DEBUG_CHANNEL上会喊出一个错误。 |示例= <pre> if ((permsYouHave & permsYouWant) == permsYouWant) llSay(PUBLIC_CHANNEL, "You have the perms you want."); else llSay(PUBLIC_CHANNEL, "You don't have the perms you want."); </pre> <pre> integer ownerPerms = llGetInventoryPermMask("inventory item name goes here", MASK_OWNER); integer copyAndModPerms = PERM_COPY | PERM_MODIFY; if ((ownerPerms & copyAndModPerms) == copyAndModPerms) llSay(PUBLIC_CHANNEL, "Owner has copy & modify perms."); else llSay(PUBLIC_CHANNEL, "Owner does not have copy & modify perms."); </pre> <pre> string getPermsAsReadableString(integer perm) { integer fullPerms = PERM_COPY | PERM_MODIFY | PERM_TRANSFER; integer copyModPerms = PERM_COPY | PERM_MODIFY; integer copyTransPerms = PERM_COPY | PERM_TRANSFER; integer modTransPerms = PERM_MODIFY | PERM_TRANSFER; string output = " perms: "; if ((perm & fullPerms) == fullPerms) output += "full"; else if ((perm & copyModPerms) == copyModPerms) output += "copy & modify"; else if ((perm & copyTransPerms) == copyTransPerms) output += "copy & transfer"; else if ((perm & modTransPerms) == modTransPerms) output += "modify & transfer"; else if ((perm & PERM_COPY) == PERM_COPY) output += "copy"; else if ((perm & PERM_TRANSFER) == PERM_TRANSFER) output += "transfer"; else output += "none"; // Remember, items in Second Life must have either // PERM_COPY or PERM_TRANSFER when "talking about" // owner perms or perms for next owner. return output; } default { state_entry() { string inventoryItemName = "inventory item name goes here"; integer basePerms = llGetInventoryPermMask(inventoryItemName, MASK_BASE); integer ownerPerms = llGetInventoryPermMask(inventoryItemName, MASK_OWNER); integer nextOwnerPerms = llGetInventoryPermMask(inventoryItemName, MASK_NEXT); integer groupPerms = llGetInventoryPermMask(inventoryItemName, MASK_GROUP); integer everyonePerms = llGetInventoryPermMask(inventoryItemName, MASK_EVERYONE); llSay(0, "/me [" + inventoryItemName + "]: base" + getPermsAsReadableString(basePerms)); llSay(0, "/me [" + inventoryItemName + "]: owner" + getPermsAsReadableString(ownerPerms)); llSay(0, "/me [" + inventoryItemName + "]: next owner" + getPermsAsReadableString(nextOwnerPerms)); llSay(0, "/me [" + inventoryItemName + "]: group" + getPermsAsReadableString(groupPerms)); llSay(0, "/me [" + inventoryItemName + "]: everyone" + getPermsAsReadableString(everyonePerms)); } } </pre> 测试反义词(例如,看某物是否不是复制的): <pre> if (!(PERM_COPY & llGetInventoryPermMask(myitem, MASK_OWNER))) llSay(PUBLIC_CHANNEL, "/me [" + myitem + "]: owner doesn't have copy perms."); </pre> 提醒下一位业主在出售前设置哪些权限,选择哪些权限需要设置; <pre> CheckPerms() { string item = llGetScriptName(); integer nextOwnerPerms = llGetInventoryPermMask(item, MASK_NEXT); if(PERM_COPY & nextOwnerPerms) llOwnerSay("Set no copy"); if(PERM_MODIFY & nextOwnerPerms) llOwnerSay("Set no mod"); if(PERM_TRANSFER & nextOwnerPerms) llOwnerSay("Set no transfer"); } default { on_rez(integer start_param) { llResetScript(); } state_entry() { if(llGetOwner() != llGetInventoryCreator(llGetScriptName())) CheckPerms(); } } </pre> |相关函数= [[llGetInventoryPermmask]] [[llGetInventoryName]] -返回库存项的名称 [[llGetInventoryType]] -测试库存项是否存在并返回其类型 [[llGetInventoryNumber]] -返回库存中特定类型的项目的数量 [[llGetInventoryKey]] -返回库存项的UUID(如果是完整的perm) [[llGetInventoryCreator]] -返回库存物品的创建者 |相关事件= }}
该页面使用的模板:
模板:LSL Header
(
查看源代码
)
模板:LSLC
(
查看源代码
)
模板:LSLGC
(
查看源代码
)
模板:Multi-lang
(
查看源代码
)
模板:函数详情
(
查看源代码
)
返回至
LlGetInventoryPermMask
。
导航菜单
个人工具
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
网站首页
知识百科
编辑帮助
最近更改
工具
链入页面
相关更改
特殊页面
页面信息