From Second Life Wiki
Template:Needs Translation/LSL/de
Template:Needs Translation/LSL/es
Template:Needs Translation/LSL/el
Template:Needs Translation/LSL/he
Template:Needs Translation/LSL/it
Template:Needs Translation/LSL/ko
Template:Needs Translation/LSL/nl
Template:Needs Translation/LSL/hu
Template:Needs Translation/LSL/no
Template:Needs Translation/LSL/da
Template:Needs Translation/LSL/sv
Template:Needs Translation/LSL/tr
Template:Needs Translation/LSL/pl
Template:Needs Translation/LSL/pt
Template:Needs Translation/LSL/ru
Template:Needs Translation/LSL/uk
Template:Needs Translation/LSL/zh-Hans
Template:Needs Translation/LSL/zh-Hant
/LSL
TakeControls
llTakeControls
Summary
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, determines whether control events are generated
|
|
| • integer
| pass_on
| –
| boolean, determines whether controls are disabled
|
|
Requires the PERMISSION_TAKE_CONTROLS permission to run.
If accept is FALSE and pass_on is FALSE, then the specified controls behave normally, and all other controls are disabled.
If accept is FALSE and pass_on is TRUE, then all controls behave normally.
If accept is TRUE and pass_on is FALSE, then the specified controls are disabled (but generate control events), and all other controls behave normally.
If accept is TRUE and pass_on is TRUE, then the specified controls generate control events, and all controls behave normally.
Examples
default
{
state_entry()
{
llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS);
}
run_time_permissions(integer perm)
{
if(PERMISSION_TAKE_CONTROLS & perm)
{
llTakeControls(
CONTROL_FWD |
CONTROL_BACK |
CONTROL_LEFT |
CONTROL_RIGHT |
CONTROL_ROT_LEFT |
CONTROL_ROT_RIGHT |
CONTROL_UP |
CONTROL_DOWN |
CONTROL_LBUTTON |
CONTROL_ML_LBUTTON |
0, TRUE, TRUE);
}
}
control(key id, integer level, integer edge)
{
integer start = level & edge;
integer end = ~level & edge;
integer held = level & ~edge;
integer untouched = ~(level | edge);
llOwnerSay(llList2CSV([level, edge, start, end, held, untouched]));
}
}
Notes
If a script has taken controls, it and other scripts in the same prim 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