LlTakeControls

From Second Life Wiki

(Redirected from LSL llTakeControls)
Jump to: navigation, search

Contents

Description

Function: llTakeControls( integer controls, integer accept, integer pass_on );
111 Function ID
0.0 Delay
10.0 Energy

Allows for intercepting of keyboard and mouse clicks, specifically those specified by controls, from the agent the script has permissions for.

• integer controls bitfield of CONTROL_* flags
• integer accept boolean, must be non-zero for the control event to work.
• integer pass_on boolean, if not FALSE then intercepted controls are passed along to the agent.


Requires the PERMISSION_TAKE_CONTROLS permission to run.
If pass_on is FALSE then the intercepted controls are not passed onto the agent (they are trapped/canceled).
If accept is false then no keys are intercepted.

Constant Value Description
CONTROL_FWD 0x00000001 Move forward control ( or W)
CONTROL_BACK 0x00000002 Move back control ( or S)
CONTROL_LEFT 0x00000004 Move left control (Shift- or Shift-A [ or A in mouselook])
CONTROL_RIGHT 0x00000008 Move right control (Shift- or Shift-D [ or D in mouselook])
CONTROL_ROT_LEFT 0x00000100 Rotate left control ( or A)
CONTROL_ROT_RIGHT 0x00000200 Rotate right control ( or D)
CONTROL_UP 0x00000010 Move up control (PgUp or E)
CONTROL_DOWN 0x00000020 Move down control (PgDn or C)
CONTROL_LBUTTON 0x10000000 Left mouse button control
CONTROL_ML_LBUTTON 0x40000000 Left mouse button control while in mouselook

Caveats

  • Do not depend upon the auto-grant status of permissions. Always use the run_time_permissions event.
  • If the script lacks the permission PERMISSION_TAKE_CONTROLS, the script will shout an error on DEBUG_CHANNEL and the operation fails (but the script continues to run).
  • Once the PERMISSION_TAKE_CONTROLS permission is granted there is no way to revoke it. The script will only loose the permission if it is reset or the object derezzed (deleted, detached, or taken).

Examples

Notes

If a script has taken controls, it will not be stopped if the Agent enters a No-Script Area. This is done to keep vehicle control alive and AOs functional. This is an intentional feature. These scripts will stop working if they call certain blacklisted functions.

See Also

Events

•  run_time_permissions Permission receiving event
•  control

Functions

•  llGetPermissions Get the permissions granted
•  llGetPermissionsKey Get the agent who granted permissions
•  llRequestPermissions Request permissions
•  llReleaseControls

Articles

•  Script permissions
Personal tools