Difference between revisions of "LlRequestPermissions"

From Second Life Wiki
Jump to navigation Jump to search
Line 10: Line 10:
|caveats=
|caveats=
<div>
<div>
* 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 only if the script is in the root prim.  If the script is not in the root prim, the user will see the confirmation dialog.
* Permissions can persist across state changes - You do not need to request permissions in the state_entry() of each state in your script.
Regardless of whether a dialog is displayed, you should always use the [[run_time_permissions]] event.  Granting of permissions takes time, and you can't know whether it's completed until the [[run_time_permissions]] handler gets invoked.
* Permissions do not accumulate.
* 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).
** 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) different permissions at the same time you can using the bitwise OR <nowiki>(|):</nowiki> <lsl>llRequestPermissions(AvatarID, PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION)</lsl></div>
** To request two or more permissions at the same time, use the bitwise OR <nowiki>(|) operator, e.g.:</nowiki> <lsl>llRequestPermissions(AvatarID, PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION)</lsl></div>
* Scripts may hold permissions for only one agent at a time. To hold permissions for multiple agents you must use more than one script.
* 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 bounced from the queue if it is full.
* The result of granting permissions effects the return of [[llGetPermissions]] and [[llGetPermissionsKey]] immediately despite the [[run_time_permissions]] event being queued or bounced from the queue if it is full.
Line 53: Line 57:
|also_articles={{LSL DefineRow||{{LSLGC|Permissions/Script|Script permissions}}|}}
|also_articles={{LSL DefineRow||{{LSLGC|Permissions/Script|Script permissions}}|}}
|notes =
|notes =
* 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 only if the script is in the root prim.  If the script is not in the root prim, the user will see the confirmation dialog.
* Permissions can persist across state changes - You do not need to request permissions in the state_entry() of each state in your script.
Regardless of whether a dialog is displayed, you should always use the [[run_time_permissions]] event.  Granting of permissions takes time, and you can't know whether it's completed until the [[run_time_permissions]] handler gets invoked.
|constants={{LSL Constants/Permissions}}
|constants={{LSL Constants/Permissions}}
|cat1=Permissions/Script
|cat1=Permissions/Script

Revision as of 11:50, 30 January 2009

Summary

Function: llRequestPermissions( key agent, integer perm );

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 Automatically granted 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 or Anyone 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; automatically revoked on stand or detach)
Camera Anyone sat on, attached
PERMISSION_TELEPORT 0x1000 teleport the agent Teleport Anyone[1]
PERMISSION_SILENT_ESTATE_MANAGEMENT 0x4000 manage estate access without notifying the owner of changes Estate Owner
PERMISSION_OVERRIDE_ANIMATIONS 0x8000 configure the overriding of default animations on agent Animation Anyone attached
PERMISSION_RETURN_OBJECTS 0x10000 Used by llReturnObjectsByOwner and llReturnObjectsByID to return objects from parcels Cleanup Owner, Group Owner

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 only if the script is in the root prim. If the script is not in the root prim, the user will see the confirmation dialog.
  • Permissions can persist across state changes - You do not need to request permissions in the state_entry() of each state in your script.

Regardless of whether a dialog is displayed, you should always use the run_time_permissions event. Granting of permissions takes time, and you can't know whether 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.: <lsl>llRequestPermissions(AvatarID, PERMISSION_TAKE_CONTROLS
All Issues ~ Search JIRA for related Bugs

Examples

Request permission to animate an avatar <lsl>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");
   }

}</lsl>

To request two (or more) different permissions at the same time you can using the bitwise OR (|) or precompute the value.

<lsl>llRequestPermissions(AvatarID, PERMISSION_TAKE_CONTROLS

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

Deep Notes

Search JIRA for related Issues

Footnotes

Signature

function void llRequestPermissions( key agent, integer perm );