LlRequestPermissions
From Second Life Wiki
| Languages: |
English • Deutsch • Español • ελληνικά • Français • עברית • Italiano • 日本語 • 한국어 • Nederlands • Magyar • Norsk • Dansk • Svenska • Türkçe • Polski • Português • Русский • украї́нська • 中文(简体) • 中文(繁體) |
| Volunteer translated pages are linked in blue, Google translated pages are linked in grey. Learn how to provide volunteer translations. | |
| LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Tutorials |
Contents |
Summary
Function: llRequestPermissions( key agent, integer perm );| 136 | Function ID |
| 0.0 | Delay |
| 10.0 | Energy |
Ask agent for permission to run certain classes of functions.
| • key | agent | – | avatar UUID that is in the same region | |
| • integer | perm | – | Permission mask (bitfield containing the permissions to request). |
Script execution continues without waiting for a response. When a response is given, a run_time_permissions event is put in the event queue.
| Constants | Action | Category | Granter | Automatic When | |
|---|---|---|---|---|---|
| PERMISSION_DEBIT | 0x2 | take money from agent's account | Money | Owner | |
| PERMISSION_TAKE_CONTROLS | 0x4 | take agent's controls | Control | Anyone | sat on, attached |
| PERMISSION_TRIGGER_ANIMATION | 0x10 | start or stop Animations on agent | Animation | Anyone | sat on, attached |
| PERMISSION_ATTACH | 0x20 | attach/detach from agent | Attachment | Owner | attached |
| PERMISSION_CHANGE_LINKS | 0x80 | change links | Link | Owner | |
| PERMISSION_TRACK_CAMERA | 0x400 | track the agent's camera position and rotation | Camera | Anyone | sat on, attached |
| PERMISSION_CONTROL_CAMERA | 0x800 | control the agent's camera (must be sat on or attached) | Camera | Anyone | sat on, attached |
Caveats
- A dialog is presented to the agent to grant these permissions except when granted automatically as shown in the table above.
- If object is attached to agent, "automatic" permissions are granted without notification upon request.
- Permissions persist across state changes.
- Regardless of whether granting is automatic, you should always use the run_time_permissions event. Granting permissions takes time, and you shouldn't assume it's completed until the run_time_permissions handler gets invoked.
- Permissions do not accumulate.
- If a permission was requested with a previous call to this function and granted, then in subsequent call was not requested, that permission is released (lost).
- To request two or more permissions at the same time, use the bitwise OR (|) operator, e.g.:
llRequestPermissions(AvatarID, PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION)
- It is currently not possible to request no permissions at all (see Issues below); as a workaround llResetScript can be used.
- Scripts may hold permissions for only one agent at a time. To hold permissions for multiple agents you must use more than one script.
- The result of granting permissions effects the return of llGetPermissions and llGetPermissionsKey immediately despite the run_time_permissions event being queued, or dropped if the object's event queue is full.
- Permission request dialogs never time out.
- If a script makes two permission requests, which ever response is last is considered the granted permissions.
- The viewer limits permission requests from any agent to any other agent to 5 dialogs in 10 seconds
Important Issues
~ Search JIRA for related Bugs| | | SVC-1006 [c] | Unable to release script permissions |
Examples
Request permission to animate an avatar
default { touch_start(integer detected) { llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION); } run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) { llStartAnimation("sit"); llOwnerSay("animation will end in 5 seconds"); llSetTimerEvent(5.0); } } timer() { llSetTimerEvent(0.0); llStopAnimation("sit"); } }
To request two (or more) different permissions at the same time you can using the bitwise OR (|) or precompute the value.
llRequestPermissions(AvatarID, PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION); integer perms = PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION; llRequestPermissions(AvatarID, perms);
See Also
Events
| • | run_time_permissions | – | Permission receiver event |
Functions
| • | llGetPermissions | – | Get the permissions granted | |
| • | llGetPermissionsKey | – | Get the avatar who granted permissions. |
Articles
| • | Script permissions |
This article wasn't helpful for you? Maybe the related article at the LSL Wiki is able to bring enlightenment.

