Difference between revisions of "LlGetObjectPermMask"
Jump to navigation
Jump to search
m |
Kireji Haiku (talk | contribs) m (added second example script) |
||
Line 9: | Line 9: | ||
|caveats | |caveats | ||
|constants={{LSL Constants Perm Mask}} | |constants={{LSL Constants Perm Mask}} | ||
|examples=See the text floating above an object blink out and then come back to say something like: | |examples= | ||
<lsl> | |||
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 permissions"; | |||
else if ((perm & copyModPerms) == copyModPerms) | |||
output += "copy & modify permissions"; | |||
else if ((perm & copyTransPerms) == copyTransPerms) | |||
output += "copy & transfer permissions"; | |||
else if ((perm & modTransPerms) == modTransPerms) | |||
output += "modify & transfer permissions"; | |||
else if ((perm & PERM_COPY) == PERM_COPY) | |||
output += "copy permissions"; | |||
else if ((perm & PERM_TRANSFER) == PERM_TRANSFER) | |||
output += "modify permissions"; | |||
// remember, neither 'only mod perms' nor 'no perms' is possible | |||
// item either has copy or mod perms at least. | |||
return | |||
output; | |||
} | |||
default | |||
{ | |||
state_entry() | |||
{ | |||
integer basePerms = llGetObjectPermMask(MASK_BASE); | |||
integer ownerPerms = llGetObjectPermMask(MASK_OWNER); | |||
integer nextOwnerPerms = llGetObjectPermMask(MASK_NEXT); | |||
integer groupPerms = llGetObjectPermMask(MASK_GROUP); | |||
integer everyonePerms = llGetObjectPermMask(MASK_EVERYONE); | |||
// PUBLIC_CHANNEL has the integer value 0 | |||
llSay(PUBLIC_CHANNEL, "base" + getPermsAsReadableString(basePerms)); | |||
llSay(PUBLIC_CHANNEL, "owner" + getPermsAsReadableString(ownerPerms)); | |||
llSay(PUBLIC_CHANNEL, "next owner" + getPermsAsReadableString(nextOwnerPerms)); | |||
llSay(PUBLIC_CHANNEL, "group" + getPermsAsReadableString(groupPerms)); | |||
llSay(PUBLIC_CHANNEL, "everyone" + getPermsAsReadableString(everyonePerms)); | |||
} | |||
} | |||
</lsl> | |||
See the text floating above an object blink out and then come back to say something like: | |||
<pre> | <pre> | ||
Open Object | Open Object |
Revision as of 10:15, 25 November 2012
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: integer llGetObjectPermMask( integer mask );0.0 | Forced Delay |
10.0 | Energy |
Returns an integer that is the requested permission mask for the root object the task is attached to.
• integer | mask | – | MASK_* flag |
|
|
Examples
<lsl> string getPermsAsReadableString(integer perm) {
integer fullPerms = PERM_COPYNotes
The perms of a newly created object often are Base = PERM_ALL, Owner = PERM_ALL, Next = PERM_MOVE or PERM_TRANSFER, Group = 0 (none), Everyone = 0 (none). The perms2String example describes those perms as "Closed / Yes Transfer".