From Second Life Wiki
(Redirected from
LSL llTakeControls)
TakeControls
llTakeControls
Description
Function: llTakeControls( integer controls, integer accept, integer pass_on );
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.
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).
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
Functions
Articles