llGetInventoryPermMask
function
Function syntax
integer llGetInventoryPermMask(string item,// Name of the item in the prim's inventory.integer group// MASK_* group (e.g.,MASK_BASE,MASK_OWNER,MASK_GROUP,MASK_EVERYONE, orMASK_NEXT) to get. Values: AssetPermissionCategory
);- Returns
integer- Energy
- 10
Returns an integer of the requested permission category for the inventory item
integer result = llGetInventoryPermMask("", 0);Specification
Section titled “Specification”
|
|
Caveats
Section titled “Caveats”- Note that including the
MASK_COMBINEDbit does not impact the output of this function, as the combined permissions are the only accessible permissions for inventory items.
Examples
Section titled “Examples”Example 1
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.");Example 2
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.");Example 3
35 collapsed lines
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 [" + inventoryItemName11 collapsed lines
+ "]: 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)); }}To test for the opposite (e.g. to see if something is NOT copy):
if (!(PERM_COPY & llGetInventoryPermMask(myitem, MASK_OWNER))) llSay(PUBLIC_CHANNEL, "/me [" + myitem + "]: owner doesn't have copy perms.");To remind the next owner what permissions to set before selling on
choose which need to be set;
CheckPerms(){ string item = llGetScriptName(); integer nextOwnerPerms = llGetInventoryPermMask(item, MASK_NEXT);
if(PERM_COPY & nextOwnerPerms)22 collapsed lines
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(); }}- In effect, the perms for articles published on this Wiki are
PERM_COPYandPERM_TRANSFERuntil you log in, thenPERM_MODIFY,PERM_MOVE,PERM_COPYandPERM_TRANSFER. - The default perms of a newly created script are: Base =
PERM_ALL, Owner =PERM_ALL, Next =PERM_MOVEorPERM_TRANSFER, Group = 0 (none), Everyone = 0 (none). These perms are the same, no matter if the script is created in user inventory or in an object. - However, an option in the Preferences > Advanced menu allows to set the Default Creation Permissions of all items that can be created or uploaded in-world.
See also
Section titled “See also”Functions
Section titled “Functions”llGetObjectPermMaskllGetInventoryAcquireTime— Returns the time the item was added to the prim’s inventoryllGetInventoryName— Returns the inventory item’s namellGetInventoryType— Tests to see if an inventory item exists and returns its typellGetInventoryNumber— Returns the number of items of a specific type in inventoryllGetInventoryKey— Returns the inventory item’s UUID (if full perm)llGetInventoryCreator— Returns the inventory item’s creator
Articles
Section titled “Articles”Original wiki source
Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.