bindKey (VBS2)
From Bohemia Interactive Community
| Editors, please check Policy: Scripting Command Page Syntax. |
Click on the images for descriptions
Introduced in
- Game:
- Virtual Battlespace 2
- Version:
- 1.20
Description
- Description:
- Assigns a command to an action key. A list of available actions can be found here. The command also accepts DIK codes as enumerated here.
If the command returns true, then the keystroke will be intercepted and will not be processed as a normal key stroke. For example, you could overwrite the "fire weapon" button, so pressing it no longer fires the weapon.
Syntax
- Syntax:
- (keystroke OR keycode) bindKey command
- Parameters:
- keystroke: String (see examples under Notes)
- keycode: Number (see examples under Notes)
- command: String (a scripting command)
- Return Value:
- Number - key index (to be used with unBindKey)
Examples
- Example 1:
"MoveForward" bindKey "removeAllWeapons player"
will disarm player as he steps forward- Example 2:
0xC8 bindKey "removeAllWeapons player"
will disarm player as he presses the UP arrow key
Additional Information
- Multiplayer:
- Behaviour unknown.
- See also:
- actionKeysNames, unBindKey, ctrlSetEventHandler, displaySetEventHandler
Notes
Notes
Notes
-
The command may not work while dialogs are open. If you need to capture keystrokes while a dialog is open you should use ctrlSetEventHandler or displaySetEventHandler.

