From Second Life Wiki
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.
|| bitfield of CONTROL_* flags
|| boolean, determines whether control events are generated
|| boolean, determines whether controls perform their normal functions
To run this function the script must request the PERMISSION_TAKE_CONTROLS permission with llRequestPermissions.
If accept is FALSE and pass_on is FALSE, the behavior is not intuitive. In this case, the complement of the specified controls do not generate events and do not perform their normal functions. They are effectively disabled. Certain control bits (e.g. CONTROL_ROT_LEFT) are also disabled when specified, in this case.
If accept is FALSE and pass_on is TRUE, then the specified controls do not generate events but perform their normal functions.
If accept is TRUE and pass_on is FALSE, then the specified controls generate events but do not perform their normal functions.
If accept is TRUE and pass_on is TRUE, then the specified controls generate events and perform their normal functions.
- Once the PERMISSION_TAKE_CONTROLS permission is granted, it can be revoked from inside the script (with llReleaseControls or a new llRequestPermissions call), or if the user chooses Release Keys from the viewer. Otherwise, the script will only lose the permission if it is reset or the object derezzed (deleted, detached, or taken).
- There appears to be no penalty for using (accept = TRUE, pass_on = TRUE) when there is no control event in the script (such as is used in AO's to ensure they work on no_script land)
- There is a bug in some permissions that prevents left clicks from working in mouselook if they are set to (accept = FALSE, pass_on = TRUE)
Important Issues ~ All Issues ~ Search JIRA for related Bugs
|| [A, C]
|| llTakeControls overrides existing controls
if(PERMISSION_TAKE_CONTROLS & perm)
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]));
If a script has taken controls, it and other scripts in the same prim will not be stopped if the Agent enters a "No Outside Scripts" parcel. This is done to keep vehicle control alive and AOs functional. This is an intentional feature.