Binds: Difference between revisions
No edit summary |
mNo edit summary |
||
Line 3: | Line 3: | ||
==Syntax== | ==Syntax== | ||
===Single | ===Single binds=== | ||
bind <span style="color:green">[key]</span> <span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span> | bind <span style="color:green">[key]</span> <span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span> | ||
Line 12: | Line 12: | ||
*'''[value]''' is the variable you want to set your setting to or an argument for a command. Not all commands require arguments. | *'''[value]''' is the variable you want to set your setting to or an argument for a command. Not all commands require arguments. | ||
===Multiple | ===Multiple binds=== | ||
You can also chain commands/settings together by separating them using a semicolon and wrapping them in quotes. You can add as many commands to this chain as you want. | You can also chain commands/settings together by separating them using a semicolon and wrapping them in quotes. You can add as many commands to this chain as you want. | ||
bind <span style="color:green">[key]</span> <span style="color:blue"><span style="color:red">"</span>[command/setting] <span style="color:purple">[value]</span><span style="color:red">;</span> [command/setting]</span> <span style="color:purple">[value]</span><span style="color:red">"</span> | bind <span style="color:green">[key]</span> <span style="color:blue"><span style="color:red">"</span>[command/setting] <span style="color:purple">[value]</span><span style="color:red">;</span> [command/setting]</span> <span style="color:purple">[value]</span><span style="color:red">"</span> | ||
===Nested | ===Nested binds=== | ||
You can nest multiple quoted strings in a single line by escaping each new set of quotes with backslashes. | You can nest multiple quoted strings in a single line by escaping each new set of quotes with backslashes. | ||
bind <span style="color:green">[key]</span> <span style="color:red">"</span>bind <span style="color:green">[key]</span> <span style="color:orange">\</span><span style="color:red">"</span><span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span><span style="color:red">;</span> bind <span style="color:green">[key]</span> <span style="color:orange">\\\</span><span style="color:red">"</span><span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span> <span style="color:orange">\\\</span><span style="color:red">"</span><span style="color:orange">\</span><span style="color:red">""</span> | bind <span style="color:green">[key]</span> <span style="color:red">"</span>bind <span style="color:green">[key]</span> <span style="color:orange">\</span><span style="color:red">"</span><span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span><span style="color:red">;</span> bind <span style="color:green">[key]</span> <span style="color:orange">\\\</span><span style="color:red">"</span><span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span> <span style="color:orange">\\\</span><span style="color:red">"</span><span style="color:orange">\</span><span style="color:red">""</span> | ||
As the quoted strings go deeper, you also need to escape the backslash. Since each new layer will again un-escape them, you need to double the amount of backslashes per layer. The third layer will require 3 backslashes, the 4th will require 7, etc. | As the quoted strings go deeper, you also need to escape the backslash. Since each new layer will again un-escape them, you need to double the amount of backslashes per layer. The third layer will require 3 backslashes, the 4th will require 7, etc. If this is confusing to look at, try making a new line for each escaped quote to get a more clear visual idea of what's happening. | ||
bind <span style="color:green">[key]</span> <span style="color:red"> | |||
"</span>bind <span style="color:green">[key]</span> <span style="color:orange"> | |||
\</span><span style="color:red">"</span><span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span><span style="color:red">;</span> bind <span style="color:green">[key]</span><span style="color:orange"> | |||
\\\</span><span style="color:red">"</span><span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span><span style="color:red">;</span> bind <span style="color:green">[key]</span> <span style="color:orange"> | |||
\\\\\\\</span><span style="color:red">"</span><span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span><span style="color:orange"> | |||
\\\\\\\</span><span style="color:red">"</span><span style="color:orange"> | |||
\\\</span><span style="color:red">"</span><span style="color:orange"> | |||
\</span><span style="color:red">" | |||
"</span> | |||
===Toggles=== | |||
Toggles are a way to use a single key to alternate between 2 values for a setting. There are two types of toggles. | |||
*'''toggle''' is used so that each time you press a key, it will change between one of the two values for the setting | |||
*'''+toggle''' is used so that your first value is set only while the key is being pressed, and the second value is set while the key is not being pressed. | |||
bind <span style="color:green">[key]</span> <span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span> | |||
bind <span style="color:green">[key]</span> <span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span> |
Revision as of 08:56, 30 July 2021
DDNet client has a multitude of commands and settings that can be bound to nearly any key or mouse button. You can enter commands into the console, which by default is accessed by pressing F1.
Syntax
Single binds
bind [key] [command/setting] [value]
This is the basic syntax for simple binds.
- [key] is the key on your keyboard/mouse you want to bind a command to. You can find keycodes here, or just type the key temporarily into one of the controls in the Settings > Controls page in DDNet client and it will show the key name.
- [command/setting] A full list of all commands and settings can be found here.
- [value] is the variable you want to set your setting to or an argument for a command. Not all commands require arguments.
Multiple binds
You can also chain commands/settings together by separating them using a semicolon and wrapping them in quotes. You can add as many commands to this chain as you want.
bind [key] "[command/setting] [value]; [command/setting] [value]"
Nested binds
You can nest multiple quoted strings in a single line by escaping each new set of quotes with backslashes.
bind [key] "bind [key] \"[command/setting] [value]; bind [key] \\\"[command/setting] [value] \\\"\""
As the quoted strings go deeper, you also need to escape the backslash. Since each new layer will again un-escape them, you need to double the amount of backslashes per layer. The third layer will require 3 backslashes, the 4th will require 7, etc. If this is confusing to look at, try making a new line for each escaped quote to get a more clear visual idea of what's happening.
bind [key] "bind [key] \"[command/setting] [value]; bind [key] \\\"[command/setting] [value]; bind [key] \\\\\\\"[command/setting] [value] \\\\\\\" \\\" \" "
Toggles
Toggles are a way to use a single key to alternate between 2 values for a setting. There are two types of toggles.
- toggle is used so that each time you press a key, it will change between one of the two values for the setting
- +toggle is used so that your first value is set only while the key is being pressed, and the second value is set while the key is not being pressed.
bind [key] [command/setting] [value]
bind [key] [command/setting] [value]