LlGetInventoryPermMask
Looking for the current API? Open the llGetInventoryPermMask reference →
Return value notes
Specification
|
|
Caveats
- Note that including the MASK_COMBINED bit does not impact the output of this function, as the combined permissions are the only accessible permissions for inventory items.
Examples
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.");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.");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));
}
}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)
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();
}
}Notes
- In effect, the perms for articles published on this Wiki are PERM_COPY and PERM_TRANSFER until you log in, then PERM_MODIFY, PERM_MOVE, PERM_COPY and PERM_TRANSFER.
- The default perms of a newly created script are: Base = PERM_ALL, Owner = PERM_ALL, Next = PERM_MOVE or PERM_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: functions
See also: articles
Tests
Shared wiki helpers
The original page also injects shared parameter notes, caveats or issue information through these helpers. Their conditional MediaWiki logic is not reproduced here; inspect the preserved helper source for additional material.
Template:LSL Function/inventory
Original shared helper source (conditional wiki logic is not evaluated)
{{LSL Injection Test}}<includeonly>{{#if:
{{:DEBUG_CHANNEL}}
{{#vardefine:p_{{{1|none}}}_desc|{{AAn|{{#if:{{{insert|}}}|{{{insert}}}|{{#if:{{{type|}}}|{{{type}}}|item}}}}}} in the {{LSLGC|Inventory|inventory}} {{#if:{{{remote|}}}|of the {{#if:{{{target|}}}|[[{{{target|}}}|target]]|target}} prim|of the prim this script is in}}{{#ifeq:{{{uuid|}}}{{{UUID|}}}|true|{{#if:{{{empty|}}}|,| or}} a {{HoverLink|UUID|Universally Unique IDentifier}}{{#if:{{{type|}}}| of {{AAn|{{{type}}}}}}}}}{{#if:{{{empty|}}}| or an empty string{{#ifeq:{{{empty}}}|*|| {{{empty}}}}}}}{{#var:p_{{{1|none}}}_desc}}}}
{{#vardefine:p_{{{1|none}}}_hover|{{AAn|{{#if:{{{insert|}}}|{{{insert}}}|{{#if:{{{type|}}}|{{{type}}}|item}}}}}} in the inventory {{#if:{{{remote|}}}|of the target prim|of the prim this script is in}}{{#ifeq:{{{uuid|}}}{{{UUID|}}}|true|{{#if:{{{empty|}}}|,| or}} a UUID{{#if:{{{type|}}}| of {{AAn|{{{type}}}|{{{type_hover|{{{type}}}}}}}}}}}}{{#if:{{{empty|}}}| or an empty string{{#ifeq:{{{empty}}}|*|| {{{empty_hover|{{{empty}}}}}}}}}}{{#var:p_{{{1|none}}}_hover}}}}
{{#vardefine:caveats{{#var:direction}}|{{#if:{{#if:{{{no_caveat|}}}||{{{1|}}}}}|{{#var:caveats{{#var:direction}}}}
{{#if:{{{empty|}}}|* If {{LSLP|{{{1}}}}} is not an empty string and...
**{{LSLP|{{{1}}}}} is missing from the prim's inventory {{#if:{{{full|}}}|or not {{HoverLink|:Category:LSL_Permissions/Asset|copy, mod and transfer|full permissions}}}} {{#ifeq:{{{uuid|}}}{{{UUID|}}}|true|and it is not a {{HoverLink|UUID|Universally Unique IDentifier}}}} {{#if:{{{type|}}}|or it is not {{AAn|{{{type|item}}}}}}} then {{#if:{{{silent|}}}|it fails silently|an error is shouted on {{#var:DEBUG_CHANNEL}}}}.
|* If {{LSLP|{{{1}}}}} is missing from the prim's inventory {{#if:{{{full|}}}|or not {{HoverLink|:Category:LSL_Permissions/Asset|copy, mod and transfer|full permissions}}}} {{#ifeq:{{{uuid|}}}{{{UUID|}}}|true|and it is not a {{HoverLink|UUID|Universally Unique IDentifier}}}} {{#if:{{{type|}}}|or it is not {{AAn|{{{type|item}}}}}}} then {{#if:{{{silent|}}}|it fails silently|an error is shouted on {{#var:DEBUG_CHANNEL}}}}. }}{{#ifeq:{{{uuid|}}}{{{UUID|}}}|true|
* If {{LSLP|{{{1}}}}} is a {{HoverLink|UUID|Universally Unique IDentifier}} then there are no new [[:Category:LSL_Permissions/Asset|asset permissions]] consequences for the object.
** The resulting object develops no new usage restrictions that might have occurred if the asset had been placed in the prims inventory.}}|{{#var:caveats{{#var:direction}}}}}}}}
{{{{#if:{{{volume|}}}|LSL Function/volume}}|{{{volume|}}}|}}
}}</includeonly><noinclude>
{{Multi-lang}}
{{UpdateLink}}
{| {{Prettytable}} {{#vardefine:caveats}}{{#vardefine:p_ta_desc}}{{#vardefine:p_ta_hover}}
|+<code><nowiki>{{{{FULLPAGENAMEE}}|ta|type=sound|uuid=true}}</nowiki></code>{{{{FULLPAGENAMEE}}|ta|type=sound|uuid=true}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|caveats}}
|-
{{VarPair|p_ta_desc}}
|-
{{VarPair|p_ta_hover}}
|}
{| {{Prettytable}} {{#vardefine:caveats}}{{#vardefine:p_ta_desc}}{{#vardefine:p_ta_hover}}
|+<code><nowiki>{{{{FULLPAGENAMEE}}|ta|type=sound|uuid=false}}</nowiki></code>{{{{FULLPAGENAMEE}}|ta|type=sound|uuid=false}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|caveats}}
|-
{{VarPair|p_ta_desc}}
|-
{{VarPair|p_ta_hover}}
|}
{| {{Prettytable}} {{#vardefine:caveats}}{{#vardefine:p_ta_desc}}{{#vardefine:p_ta_hover}}
|+<code><nowiki>{{{{FULLPAGENAMEE}}|ta|type=landmark|uuid=true|empty=(for teleporting within the same region)}}</nowiki></code>{{{{FULLPAGENAMEE}}|ta|type=landmark|uuid=true|empty=(for teleporting within the same region)}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|caveats}}
|-
{{VarPair|p_ta_desc}}
|-
{{VarPair|p_ta_hover}}
|}
</noinclude>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.