Don't click here unless you want to be banned.

LSL Wiki : llGetPermissions

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl814.us.archive.org
integer llGetPermissions();

Returns which permissions have been granted. The return value will be a bitmask of the following values:

Constant: Result Allows
PERMISSION_DEBIT Permission to take money from agent's account. Use of llGiveMoney.
PERMISSION_TAKE_CONTROLS Permission to take agent's controls. Use of llTakeControls and llReleaseControls
PERMISSION_TRIGGER_ANIMATION Permission to trigger animation on agent. Use of llStartAnimation and llStopAnimation.
PERMISSION_ATTACH Permission to attach/detach from agent. Use of llAttachToAvatar and llDetachFromAvatar
PERMISSION_CHANGE_LINKS Permission to change links. Use of llCreateLink, llBreakLink, and llBreakAllLinks
PERMISSION_TRACK_CAMERA Permission to track the agent's camera position and rotation Use of llGetCameraPos and llGetCameraRot
PERMISSION_CONTROL_CAMERA Permission to control the agent's camera Use of llSetCameraParams and llClearCameraParams

To compare the resulting number to these constants, remember that it is necessary to use bitwise operators! That means doing if (llGetPermissions() & PERMISSION_ATTACH), not if (llGetPermissions() == PERMISSION_ATTACH). The latter may work some of the time, but not in all cases.

Example:
integer perm = llGetPermissions();

if (perm & PERMISSION_DEBIT) // using & is important! perm is a bitmask!
{
    // debit code goes here
}

Q: How does this know what agent to get the permissions from?
A: The last person who requested permissions. Use llGetPermissionsKey to find out the key of the agent.

Q: Is there a way to find out what permissions are already granted for a different agent, or do I need to keep a list of my own?
A: If you wanted a script to get permissions from more than one person, you would have to keep a list of your own.

Q: It's returning a value that I check against the constants listed in the table above, and nothing happens. What's up with that?
A: Are you sure you're using bitwise operators in your IF statement? (For instance, & instead of ==?) The value returned by llGetPermissions is a bitfield, and will not equal any of the above constants if more than one have been granted and are returned.

Compare with llRequestPermissions and llGetPermissionsKey.


This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Agent/Avatar
Comments [Hide comments/form]
How do you revoke privileges? Once I was unable to stop dancing because an object's script had permission to animate me and kept animating me every few seconds.
-- PetreLamar (2006-07-31 13:48:37)
Attach a comment to this page: