Bind: Difference between revisions
No edit summary |
(Split key table up once more and named sub-tables. Added keys ctrl and f1 to f12. Sorted keys a bit, to get more "left to right". Used dark <pre>.) |
||
Line 6: | Line 6: | ||
==Syntax== | ==Syntax== | ||
{{pre|bind KEY COMMANDS}} | |||
If you wanted to make | If you wanted to make {{key|v}} toggle {{ent|noclip}}, you would type <code>bind "v" "noclip"</code> in the console. | ||
{{note|Quotation marks around strings are not always required, but should be used to ensure that special characters, such as spaces and semicolons, are not misinterpreted.}} | {{note|Quotation marks around strings are not always required, but should be used to ensure that special characters, such as spaces and semicolons, are not misinterpreted.}} | ||
==Special Keys== | ==Special Keys== | ||
{| class="standard-table" style=float:left | {| class="standard-table" style=float:left | ||
|+ System Commands, Modifier Keys, Other | |||
! Bind name | ! Bind name | ||
! Key | ! Key | ||
|- | |||
| f'''''1-12''''' | |||
| F1 to F12 (Top Row) | |||
|- id="escape" | |||
| escape | |||
| "ESC" (Top Left of keyboard) | |||
|- id="tab" | |- id="tab" | ||
| tab | | tab | ||
Line 21: | Line 28: | ||
| capslock | | capslock | ||
| Capslock | | Capslock | ||
|- id="shift" | |- id="shift" | ||
| shift | | shift | ||
| Shift (Below Capslock) | | Shift (Below Capslock) | ||
|- id="ctrl" | |||
| ctrl | |||
| Control (Below Capslock) | |||
|- id="alt" | |||
| alt | |||
| Alt (Left of Spacebar) | |||
|- id="space" | |||
| space | |||
| Spacebar | |||
|- id="backspace" | |- id="backspace" | ||
| backspace | | backspace | ||
Line 38: | Line 48: | ||
|- id="semicolon" | |- id="semicolon" | ||
| semicolon | | semicolon | ||
| Semicolon (This symbol: ";" | | Semicolon (This symbol: "<tt>;</tt>") | ||
|- id="lwin" | |- id="lwin" | ||
| lwin | | lwin | ||
Line 57: | Line 58: | ||
| apps | | apps | ||
| Menu | | Menu | ||
|- id="numlock" | |||
| numlock | |||
| Numlock | |||
|- id="scrolllock" | |||
| scrolllock | |||
| Scrolllock | |||
|} | |||
{| class="standard-table" style=float:left | |||
|+ Navigation Keys | |||
! Bind name | |||
! Key | |||
|- id="uparrow" | |- id="uparrow" | ||
| uparrow | | uparrow | ||
Line 92: | Line 104: | ||
|} | |} | ||
{| class="standard-table" style=float:left | {| class="standard-table" style=float:left | ||
|+ Number Pad | |||
! Bind name | ! Bind name | ||
! Key | ! Key | ||
Line 144: | Line 157: | ||
|} | |} | ||
{| class="standard-table" style=float:left | {| class="standard-table" style=float:left | ||
|+ Mouse Buttons | |||
! Bind name | ! Bind name | ||
! Key | ! Key | ||
Line 180: | Line 194: | ||
Set the maximum number of binds per command when on console. Does not apply to desktop. | Set the maximum number of binds per command when on console. Does not apply to desktop. | ||
Syntax: | Syntax: | ||
{{pre|binds_per_command MAX}} | |||
===BindToggle=== | ===BindToggle=== | ||
A convenient command for toggling a [[Cvar]] on or off by pressing a key. Functionally identical to <code>bind KEY "{{ent|incrementvar}} CVAR 0 1 1"</code>. | A convenient command for toggling a [[Cvar]] on or off by pressing a key. Functionally identical to <code>bind KEY "{{ent|incrementvar}} CVAR 0 1 1"</code>. | ||
Syntax: | Syntax: | ||
{{pre|BindToggle KEY CVAR}} | |||
If you wanted your '''p''' key to turn {{ent|sv_cheats}} on or off, you would type <code>BindToggle p sv_cheats</code>. | If you wanted your '''p''' key to turn {{ent|sv_cheats}} on or off, you would type <code>BindToggle p sv_cheats</code>. | ||
Line 195: | Line 211: | ||
The opposite of <code>bind</code>. Sets a key to do nothing. | The opposite of <code>bind</code>. Sets a key to do nothing. | ||
Syntax: | Syntax: | ||
{{pre|unbind KEY}} | |||
To make your left click do nothing, you would type <code>unbind MOUSE1</code>. | To make your left click do nothing, you would type <code>unbind MOUSE1</code>. | ||
Line 211: | Line 228: | ||
Example input and output from Half-Life 2: | Example input and output from Half-Life 2: | ||
{{ExpandBox| | {{ExpandBox|{{pre| | ||
] key_listboundkeys | ] key_listboundkeys | ||
"6" = "slot6" | "6" {{=}} "slot6" | ||
"1" = "slot1" | "1" {{=}} "slot1" | ||
"a" = "+moveleft" | "a" {{=}} "+moveleft" | ||
"2" = "slot2" | "2" {{=}} "slot2" | ||
"c" = "impulse 50" | "c" {{=}} "impulse 50" | ||
"3" = "slot3" | "3" {{=}} "slot3" | ||
"d" = "+moveright" | "d" {{=}} "+moveright" | ||
"4" = "slot4" | "4" {{=}} "slot4" | ||
"e" = "+use" | "e" {{=}} "+use" | ||
"5" = "slot5" | "5" {{=}} "slot5" | ||
"f" = "impulse 100" | "f" {{=}} "impulse 100" | ||
"g" = "phys_swap" | "g" {{=}} "phys_swap" | ||
"q" = "lastinv" | "q" {{=}} "lastinv" | ||
"w" = "+forward" | "w" {{=}} "+forward" | ||
"r" = "+reload" | "r" {{=}} "+reload" | ||
"z" = "+zoom" | "z" {{=}} "+zoom" | ||
"s" = "+back" | "s" {{=}} "+back" | ||
"`" = "toggleconsole" | "`" {{=}} "toggleconsole" | ||
"SPACE" = "+jump" | "SPACE" {{=}} "+jump" | ||
"NUMLOCK" = "pause" | "NUMLOCK" {{=}} "pause" | ||
"ESCAPE" = "cancelselect" | "ESCAPE" {{=}} "cancelselect" | ||
"SHIFT" = "+speed" | "SHIFT" {{=}} "+speed" | ||
"CTRL" = "+duck" | "CTRL" {{=}} "+duck" | ||
"ALT" = "+walk" | "ALT" {{=}} "+walk" | ||
"F5" = "jpeg" | "F5" {{=}} "jpeg" | ||
"F6" = "save quick" | "F6" {{=}} "save quick" | ||
"F9" = "load quick" | "F9" {{=}} "load quick" | ||
"MOUSE1" = "+attack" | "MOUSE1" {{=}} "+attack" | ||
"MWHEELDOWN" = "invnext" | "MWHEELDOWN" {{=}} "invnext" | ||
"MOUSE2" = "+attack2" | "MOUSE2" {{=}} "+attack2" | ||
"MWHEELUP" = "invprev" | "MWHEELUP" {{=}} "invprev" | ||
}}}} | |||
===key_findbinding=== | ===key_findbinding=== | ||
Searches through the list of bound keys and returns the ones that have a given substring in the command field. | Searches through the list of bound keys and returns the ones that have a given substring in the command field. | ||
Syntax: | Syntax: | ||
{{pre|key_findbinding STRING}} | |||
Example input and output from Half-Life 2: | Example input and output from Half-Life 2: | ||
{{pre|] key_findbinding slot | |||
"1" = "slot1" | "1" {{=}} "slot1" | ||
"2" = "slot2" | "2" {{=}} "slot2" | ||
"3" = "slot3" | "3" {{=}} "slot3" | ||
"4" = "slot4" | "4" {{=}} "slot4" | ||
"5" = "slot5" | "5" {{=}} "slot5" | ||
"6" = "slot6" | "6" {{=}} "slot6" | ||
}} | |||
===key_updatelayout=== | ===key_updatelayout=== |
Revision as of 09:34, 2 November 2022


bind
is a console command used to bind a key to one or several other commands. Typically, when binds are made, the corresponding bind
command is stored in config.cfg
, which is ran wen the engine starts, leading to binds staying active between sessions, unless config.cfg
is set to read-only.

+forward
may not work when in multi-command chains inside binds.Syntax
bind KEY COMMANDS
If you wanted to make v toggle noclip, you would type bind "v" "noclip"
in the console.

Special Keys
Bind name | Key |
---|---|
f1-12 | F1 to F12 (Top Row) |
escape | "ESC" (Top Left of keyboard) |
tab | Tabulator (Above Capslock) |
capslock | Capslock |
shift | Shift (Below Capslock) |
ctrl | Control (Below Capslock) |
alt | Alt (Left of Spacebar) |
space | Spacebar |
backspace | Backspace (Above Enter) |
enter | Enter |
semicolon | Semicolon (This symbol: ";") |
lwin | Windows Key (Left of Spacebar) |
rwin | Windows Key (Right of Spacebar) |
apps | Menu |
numlock | Numlock |
scrolllock | Scrolllock |
Bind name | Key |
---|---|
uparrow | Up Arrow |
downarrow | Down Arrow |
leftarrow | Left Arrow |
rightarrow | Right Arrow |
ins | Insert (Above arrows) |
del | Delete (Above arrows) |
pgdn | Page Down (Above arrows) |
pgup | Page Up (Above arrows) |
home | Home (Above arrows) |
end | End (Above arrows) |
pause | Pause / Break (Above arrows) |
Bind name | Key |
---|---|
kp_end | Keypad 1 |
kp_downarrow | Keypad 2 |
kp_pgdn | Keypad 3 |
kp_leftarrow | Keypad 4 |
kp_5 | Keypad 5 |
kp_rightarrow | Keypad 6 |
kp_home | Keypad 7 |
kp_uparrow | Keypad 8 |
kp_pgup | Keypad 9 |
kp_enter | Keypad Enter |
kp_ins | Keypad 0 |
kp_del | Keypad . |
kp_slash | Keypad / |
kp_multiply | Keypad * |
kp_minus | Keypad - |
kp_plus | Keypad + |
Bind name | Key |
---|---|
mwheeldown | Mouse - Scroll Down |
mwheelup | Mouse - Scroll Up |
mouse1 | Mouse - Left click |
mouse2 | Mouse - Right click |
mouse3 | Mouse - Wheel click |
mouse4 | Mouse - Page Back |
mouse5 | Mouse - Page Forward |
joy1-32 | Joystick & gamepad buttons. |
aux1-32 | Legacy. Maps directly to joy1-32. |
Related console commands
binds_per_command
Set the maximum number of binds per command when on console. Does not apply to desktop.
Syntax:
binds_per_command MAX
BindToggle
A convenient command for toggling a Cvar on or off by pressing a key. Functionally identical to bind KEY "incrementvar CVAR 0 1 1"
.
Syntax:
BindToggle KEY CVAR
If you wanted your p key to turn sv_cheats on or off, you would type BindToggle p sv_cheats
.
bind_mac
Functions identically to bind
except it only affects Mac OS users.
unbind
The opposite of bind
. Sets a key to do nothing.
Syntax:
unbind KEY
To make your left click do nothing, you would type unbind MOUSE1
.
unbind_mac
Functions identically to unbind
except it only affects Mac OS users.
unbindall
The infamous command that unbinds all the keys.

key_listboundkeys
Lists all keys that are bound to something, and what they are bound to.
Example input and output from Half-Life 2:
] key_listboundkeys "6" = "slot6" "1" = "slot1" "a" = "+moveleft" "2" = "slot2" "c" = "impulse 50" "3" = "slot3" "d" = "+moveright" "4" = "slot4" "e" = "+use" "5" = "slot5" "f" = "impulse 100" "g" = "phys_swap" "q" = "lastinv" "w" = "+forward" "r" = "+reload" "z" = "+zoom" "s" = "+back" "`" = "toggleconsole" "SPACE" = "+jump" "NUMLOCK" = "pause" "ESCAPE" = "cancelselect" "SHIFT" = "+speed" "CTRL" = "+duck" "ALT" = "+walk" "F5" = "jpeg" "F6" = "save quick" "F9" = "load quick" "MOUSE1" = "+attack" "MWHEELDOWN" = "invnext" "MOUSE2" = "+attack2" "MWHEELUP" = "invprev"
key_findbinding
Searches through the list of bound keys and returns the ones that have a given substring in the command field.
Syntax:
key_findbinding STRING
Example input and output from Half-Life 2:
] key_findbinding slot "1" = "slot1" "2" = "slot2" "3" = "slot3" "4" = "slot4" "5" = "slot5" "6" = "slot6"
key_updatelayout
Updates game keyboard layout to current windows keyboard setting. Only works on windows.
This is only useful if your virtual keyboard layout changes in Windows (i.e changing from QWERTY to AZERTY) while the game is running.