Reference: ActionMap
Table of Contents
|
Class Hierarchy
ActionMap -> [[T3D/Scripters/Reference:_SimObject |SimObject]]
Methods
bind( %device , %action , [ %modifier , %mod… ] , %command )
Purpose Use the bind method to associate a function to a keystroke or other device input. |
Syntax device - Name of the device to bind the command to (see 'Device Table' below). action - Name of the action to watch for (see 'Action Table' below). modifier - Special modifiers (mouse only), such as dead spot, etc. command - The function to be called on make and break. |
Returns No return value. |
Notes The command bound via the bind function must be specified as a flat name with no ellipses or semi-colon termination and will be called on make and break events (i.e. key press and release for a mapped key). Args - Warning: When a function is bound to a keystroke or other device input, and no other versions of the binding are provided, the function will be called even if a modifier key like CTRL, ALT, or SHIFT is also pressed. For clarification, see 'Bind Sample' example below. |
bindCmd( %device , %action , %makeCmd , %breakCmd )
Purpose Use the bindCmd method to associate up to two functions to a keystroke or other device input. |
Syntax device - Name of the device to bind the command to (see 'Device Table' below). action - Name of the action to watch for (see 'Action Table' below). makeCmd - The function to be called on make event. breakCmd - The function to be called on break event. |
Returns No return value. |
Notes The makeCmd is bound to the make event and the breakCmd is bound to the break event and in both cases, the commands are specified as complete scripts, with all arguments, ellipses, and the terminating semi-colon. Either of these commands may be non-specified (NULL strings). For clarification, see 'Bind Sample' example below. |
bindObj( %device, %action, [%modifier, %mod…], %command, %object )
Purpose Use the bind method to associate a function to a keystroke or other device input. |
Syntax device - Name of the device to bind the command to (see 'Device Table' below). action - Name of the action to watch for (see 'Action Table' below). modifier - Special modifiers (mouse only), such as dead spot, etc. command - The function to be called on make and break. object - The explicit object; it defaults to NULL when you call bind(). |
Returns No return value. |
Notes The command bound via the bind function must be specified as a flat name with no ellipses or semi-colon termination and will be called on make and break events (i.e. key press and release for a mapped key). Args - Warning: When a function is bound to a keystroke or other device input, and no other versions of the binding are provided, the function will be called even if a modifier key like CTRL, ALT, or SHIFT is also pressed. For clarification, see 'Bind Sample' example below. |
getBinding( %command )
Purpose Use the getBinding method to get the binding for a specified command. |
Syntax command - The function to seek a binding for. |
Returns Returns a string containing the binding as a field (TAB separated string), or a NULL string meaning 'no binding found'. |
Notes None |
getCommand( %device , %action )
Purpose Use the getCommand method to get the function associated with a specific device + action pair. |
Syntax device - Name of the device to bound to a command (see 'Device Table' below). action - Name of the action to watch for (see 'Action Table' below). |
Returns Returns the function name or specification associated with the specified device + action pair, or a NULL-string meaning 'no binding found'. |
Notes None |
getDeadZone( %device , %action )
Purpose Use the getDeadZone method to get the dead-zone associated with a specific device + action pair. |
Syntax device - Name of the device to bound to a command (see 'Device Table' below). action - Name of the action to watch for (see 'Action Table' below). |
Returns Returns a dead-zone specification, or "0 0" meaning that there is no dead-zone, or a NULL string meaning the mapping was not found. |
Notes None |
getScale( %device , %action )
Purpose Use the getScale method to get the scale associated with a specific device + action pair. |
Syntax device - Name of the device to bound to a command (see 'Device Table' below). action - Name of the action to watch for (see 'Action Table' below). |
Returns Returns 1 if no scale is associated with the specified device + action pair, or the mapping was not found. |
Notes None |
isInverted( %device , %action )
Purpose Use the isInverted method to determine if a specific device + action pair in inverted. |
Syntax device - Name of the device to bound to a command (see 'Device Table' below). action - Name of the action to watch for (see 'Action Table' below). |
Returns Returns 1 if the mouse (or other scrolling device) is inverted, 0 otherwise. |
Notes This only applies to scrolling devices. |
pop()
Purpose Use the pop method to de-activate an ActionMap and remove it from the non-global ActionMap stack. |
Syntax None |
Returns No return value. |
Notes None |
push()
Purpose Use the push method to activate an ActionMap and place it at the top of the non-global ActionMap stack. |
Syntax None |
Returns No return value. |
Notes None |
save ( [ %fileName ] [ , %append ] )
Purpose Use the save method to save an entire action map specification to a file. If append is not specified, or specified as false, fileName will be overwritten, otherwise the action map will be appended to the file. |
Syntax fileName - Full path to file in which to store action map definition. append - If true, do not overwrite the file, else start from scratch. |
Returns {$returns} |
Notes None |
unbind( %device , %action )
unbindObj( %device , %action, %object )
Purpose Use the unbind method to remove a previously specified device + action pair from the action map. |
Syntax device - Name of the device to bound to a command (see 'Device Table' below). action - Name of the action to watch for (see 'Action Table' below). object - The explicit object; it defaults to NULL when you call bind(). |
Returns No return value. |
Notes None |
Notes
Device Table
Device | Description |
keyboardN | This is the Nth keyboard hooked up to the system. For the first keyboard, either "keyboard" or "keyboard0" is acceptable. |
mouseN | This is the Nth mouse hooked up to the system. For the first mouse, either "mouse" or "mouse 0" is acceptable. |
joystickN | This is the Nth joystick or gamepad hooked up to the system. |
Action Table
Action | Description |
button0, button1, …, button31 | This is a mouse, joystick, or gamepad button press. For the mouse, buttons 0, 1, and 2 are left, right, and middle buttons repspectively. |
a…z, A…Z, 0…9, F1…F12 | These are keyboard inputs. Because this list is so long and in order to accommodate possible variances for special keyboards and other devices, a same GUI has been provided with the kit that displays the current action, be it keyboard, mouse, joystick/gamepad, or other device. Simple start the kit and click SampleGUIs -> Input. Follow the instructions provided in the sample. |
left, up, right, down | These represent the keyboard arrow keys. |
shift, ctrl, alt | These are modifiers and are not used standalone, but they are included in the action string, for example: "shift p" is the shift key and the p key pressed at the same time. |
lshift, rshift, lcontrol, rcontrol, lalt, ralt | These are special modifier actions. They only register as 'break' events when one of these keys: left shift, right shift, left ctrl, right ctrl, left alth, or right alt is released. |
anykey | Special action for "any" key press. |
Mouse Modifiers
Action Modifiers | Description |
D %x %y | Has dead zone. This is used to add a dead zone for the mouse. Motions in this zone will not be recorded. This can be used to remove the jitter caused by a nervous hand. |
S %s | Has Scale. This is used to scale the mouse motion (by a multiple). |
I | Inverted. This is used to invert the mouse. |
R %s | Has Scale. Same as S. |
XInput Gamepad Modifiers
Action Modifiers | Description |
connect | Left and right thumbsticks. |
thumblx, thumbly, thumbrx, thumbry | Controller connect /disconnect |
dpadu, dpadd, dpadl, dpadr | DPAD buttons. |
btn_start, btn_back | Start and Back buttons. |
btn_lt, btnrt | Left and right Thumbstick buttons. |
btn_l, btn_r | Left and right shoulder buttons. |
btn_a, btn_b, btn_x, btn_y | Primary gamepad buttons. |
page revision: 6, last edited: 14 Jul 2014 17:47