Control

From Second Life Wiki
Revision as of 02:30, 14 February 2007 by Strife Onizuka (talk | contribs)
Jump to navigation Jump to search

Description

Event: control( key id, integer level, integer edge ){ ; }

Result of llTakeControls library function call and user input.

• key id
• integer level
• integer edge
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"

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 unheld = ~(level & edge);
        llOwnerSay(llList2CSV([level, edge, start, end, held, unheld]));
    }
}

Notes

llGetRot in mouselook for an attachment returns the angle the avatar is looking in.

Deep Notes

Signature

event void control( key id, integer level, integer edge );