Difference between revisions of "LlTakeControls"

From Second Life Wiki
Jump to navigation Jump to search
Line 2: Line 2:
|func_id=111|func_sleep=0.0|func_energy=10.0
|func_id=111|func_sleep=0.0|func_energy=10.0
|sort=TakeControls|func=llTakeControls
|sort=TakeControls|func=llTakeControls
|p1_type=integer|p1_name=controls|p2_type=integer|p2_name=accept|p3_type=integer|p3_name=pass_on
|p1_type=integer|p1_name=controls|p1_desc=bitfield of CONTROL_* flags
|func_footnote
|p2_type=integer|p2_name=accept|p2_desc=boolean, must be non-zero for the [[control]] event to work.
|func_desc=Take controls from agent task has permissions for. If (accept == (controls & input)), send input to task. If '''pass_on''' send to agent also.
|p3_type=integer|p3_name=pass_on|p3_desc=boolean, if not [[FALSE]] then intercepted controls are passed along to the agent.
|func_footnote=If '''pass_on''' is [[FALSE]] then the intercepted controls are not passed onto the agent (they are trapped/canceled).<br/>
If '''accept''' is false then no keys are intercepted.
|func_desc=Allows for intercepting of keyboard and mouse clicks, specifically those specified by '''controls''', from the agent the script has permissions for.
|return_text
|return_text
|spec
|spec
Line 15: Line 18:
|also_articles
|also_articles
|also_tests
|also_tests
|notes=If a script has taken controls, it will not be stopped if the Agent enters a No-Script Area. This somehow makes sense to keep vehicle control alive, and this also leads to AOs not stopping in no-script areas, but it is not clear if this is a bug or intentional.
|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.
|cat1=Controls
|cat1=Controls
|cat2
|cat2

Revision as of 21:27, 15 June 2008

Summary

Function: llTakeControls( integer controls, integer accept, integer pass_on );
0.0 Forced 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.

To run this function the script must request the PERMISSION_TAKE_CONTROLS permission with llRequestPermissions. 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
(undocumented) 0x02000000 Avatar left rotation detected. Triggers llGetAnimation == "Turning Left"
(undocumented) 0x04000000 Avatar right rotation detected. Triggers llGetAnimation == "Turning Right"

Caveats

Permissions
  • 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. The script will also lose this permission on reset, or if the object is deleted, detached, or dropped.

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

Deep Notes

Signature

function void llTakeControls( integer controls, integer accept, integer pass_on );