Control

From Second Life Wiki
Revision as of 01:13, 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 Move forward control.
CONTROL_BACK Move back control.
CONTROL_LEFT Move left control.
CONTROL_RIGHT Move right control.
CONTROL_ROT_LEFT Rotate left control.
CONTROL_ROT_RIGHT Rotate right control.
CONTROL_UP Move up control.
CONTROL_DOWN Move down control.
CONTROL_LBUTTON Left mouse button control.
CONTROL_ML_LBUTTON Left mouse button control while in mouselook.

Caveats


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]));
    }
}

Deep Notes

Signature

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