Binds/zh: Difference between revisions

From DDraceNetwork
mNo edit summary
(Updating to match new version of source page)
Line 1: Line 1:
{{DISPLAYTITLE:绑定}}
<languages/>
{{LangNavBox}}
<div lang="en" dir="ltr" class="mw-content-ltr">
在《DDNet》里你能通过F1控制台将[[Settings and Commands/zh|设置与指令]]'''绑定'''到您的键盘和鼠标上。
DDNet client has a multitude of [https://ddnet.org/settingscommands/#client-settings 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.'''
</div>


==语法==
===单指令绑定===
bind {{color|green|[按键]}} {{color|blue|[设置/指令]}} {{color|purple|[参数]}}
此为绑定的基本语法。
*'''[按键]''':键盘和鼠标上您所选的任意按键。
*'''[设置/指令]''':您可以在官方网站([https://ddnet.org/settingscommands/#client-settings 客户端设置]/[https://ddnet.org/settingscommands/#client-commands 客户端指令])或站内页面([[Settings and Commands/zh#客户端设置|客户端设置]]/[[Settings and Commands/zh#客户端指令|客户端指令]])查找相关设置和指令。
*'''[参数]''':您想要调整的设置或指令的变量或参数。(仅有某些设置需要使用参数,指令和某些设置无需参数)
倘若您不知道某个按键的名称,可以在[https://github.com/ddnet/ddnet/blob/master/src/engine/client/keynames.h 这个页面]中查找,亦或者在游戏设置 > 控制中随意找一格按下你想要的按键,即会显示按键名称。您也可以与修饰键{{key press|ctrl}}、{{key press|shift}}、{{key press|alt}}和GUI键(即Windows的{{key press|Win}}、Mac的{{key press|Command}}、Linux的{{key press|Super}})一起使用,如下:
bind {{color|magenta|ctrl+}}{{color|green|[按键]}} {{color|blue|[设置/指令]}} {{color|purple|[参数]}}


===多指令绑定===
<div lang="en" dir="ltr" class="mw-content-ltr">
您可以使用分号将多条设置与指令绑定到单一按键上:
==Syntax==
bind {{color|green|[按键]}} {{color|red|"}}{{color|blue|[设置/指令]}} {{color|purple|[参数]}}{{color|red|;}}{{color|blue|[设置/指令]}} {{color|purple|[参数]}}{{color|red|"}}
</div>
当您按下此按键后,所有绑定到这个按键的设置与指令会在同一时间被激活,换言之,这些设置与指令不会按照您所写的顺序依次激活。如果您想它们依次激活,您可以将它们分别绑定到不同的按键上,依次按下以激活,或者[[#使用配置文件|使用配置文件]]让您多次按下同一按键时激活不同的设置与指令。


===嵌套绑定===
您可以使用反斜杠将一条绑定嵌套在另一绑定中:
bind {{color|green|[按键]}} {{color|red|"}}bind {{color|green|[按键]}} {{color|orange|\}}{{color|red|"}}{{color|blue|[设置/指令]}} {{color|purple|[参数]}}{{color|red|;}} bind {{color|green|[按键]}} {{color|orange|\\\}}{{color|red|"}}{{color|blue|[设置/指令]}} {{color|purple|[参数]}} {{color|orange|\\\}}{{color|red|"}}{{color|orange|\}}{{color|red|""}}
客户端的字符长度限制为255,而每一层嵌套的反斜杠数量为上一层的反斜杠数量乘二加一。倘若您使用六层嵌套,反斜杠数量将会是240个(1*2 + 3*2 + 7*2 + 15*2 + 31*2 + 63*2),这样您只剩15个字符可键入,因此只能接受最多五层嵌套。每一层的反斜杠数量如下:
1 = 1  {{color|orange|\}}
2 = 3  {{color|orange|\\\}}
3 = 7  {{color|orange|\\\\\\\}}
4 = 15  {{color|orange|\\\\\\\\\\\\\\\}}
5 = 31  {{color|orange|\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\}}
如果您仍感到疑惑,可看下方的拆解:
bind {{color|green|[按键]}}
  {{color|red|"}}bind {{color|green|[按键]}}
  {{color|orange|\}}{{color|red|"}}{{color|blue|[设置/指令]}} {{color|purple|[参数]}}{{color|red|;}} bind {{color|green|[按键]}}
    {{color|orange|\\\}}{{color|red|"}}{{color|blue|[设置/指令]}} {{color|purple|[参数]}}{{color|red|;}} bind {{color|green|[按键]}}
    {{color|orange|\\\\\\\}}{{color|red|"}}{{color|blue|[设置/指令]}} {{color|purple|[参数]}}
    {{color|orange|\\\\\\\}}{{color|red|"}}
    {{color|orange|\\\}}{{color|red|"}}
  {{color|orange|\}}{{color|red|"}}
  {{color|red|"}}


===实用设置与指令===
<div lang="en" dir="ltr" class="mw-content-ltr">
====切换====
===Single binds===
切换(英语:Toggles)指令可以让您在单个按键切换设置的两个参数。客户端中有两种切换方式。
</div>


*'''toggle''':令您每按一次按键时切换为另一个参数。
<div lang="en" dir="ltr" class="mw-content-ltr">
*'''+toggle''':令您在按下按键时使用第一个参数,松开按键时则使用第二个参数。
bind <span style="color:green">[key]</span> <span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span>
bind {{color|green|[按键]}} {{color|red|"}}{{color|magenta|toggle}} {{color|blue|[设置]}} {{color|purple|[参数1] [参数2]}}{{color|red|"}}
</div>


bind {{color|green|[按键]}} {{color|red|"}}{{color|magenta|+toggle}} {{color|blue|[设置]}} {{color|purple|[参数1] [参数2]}}{{color|red|"}}
<div lang="en" dir="ltr" class="mw-content-ltr">
This is the basic syntax for simple binds.
</div> 


====说话====
<div lang="en" dir="ltr" class="mw-content-ltr">
说话(英语:Say)指令可以帮您在聊天框里快速输入文本。
*'''[key]''' is the key on your keyboard/mouse you want to bind a command to.
  bind {{color|green|[按键]}} {{color|magenta|say}} {{color|blue|/[聊天框指令]}}
*'''[command/setting]''' A full list of all commands and settings can be found [https://ddnet.org/settingscommands/#client-settings here].
*'''[value]''' is the variable you want to set your setting to or an argument for a command.  Not all commands require arguments
You can find keycodes [https://github.com/ddnet/ddnet/blob/master/src/engine/client/keynames.h 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.  You can also use modifier keys with binds.
  bind <span style="color:magenta">ctrl+</span><span style="color:green">[key]</span> <span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span>
you can use '''ctrl''', '''alt''', '''shift''', and '''gui'''.  '''Gui''' is used to refer to the windows key on windows, the command key on macos/osx, and super/meta on linux.
</div>


bind {{color|green|[按键]}} {{color|magenta|say}} {{color|blue|[聊天信息]}}


====颜色====
<div lang="en" dir="ltr" class="mw-content-ltr">
某些客户端指令可以让您设置颜色,例如:
===Multiple binds===
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
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>
It's important to know that when chaining things together like this, all commands/settings get executed by the game at the exact same time, meaning they will not execute sequentially in the order you write them.  There is no sleep or delay type command to space things out the way you want them.  The best way to make things happen in an ordered sequence is to either bind a different key for each step of the sequence, or to use [https://wiki.ddnet.org/wiki/Binds#Using_Config_Files config files] to press one key multiple times to read multiple files.
</div>
 
 
<div lang="en" dir="ltr" class="mw-content-ltr">
=== Nested binds===
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
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>
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 maximum amount of layers you can use is '''5''' before the console gives you an error.  This is because the console has a maximum character limit of '''255'''.  The amount of backslashes for 6 layers is '''240''' (1*2 + 3*2 + 7*2 + 15*2 + 31*2 + 63*2), leaving you with only '''15''' characters.
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
1 = 1  <span style="color:orange">\</span>
2 = 3  <span style="color:orange">\\\</span>
3 = 7  <span style="color:orange">\\\\\\\</span>
4 = 15  <span style="color:orange">\\\\\\\\\\\\\\\</span>
5 = 31  <span style="color:orange">\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\</span>
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.
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
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>
</div>
 
 
<div lang="en" dir="ltr" class="mw-content-ltr">
===Useful Commands & Settings===
</div>
 
 
<div lang="en" dir="ltr" class="mw-content-ltr">
====Toggles====
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
Toggles are a way to use a single key to alternate between 2 values for a setting.  There are two types of toggles.
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
*'''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 when the key is released.
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
bind <span style="color:green">[key]</span> <span style="color:red">"</span><span style="color:magenta">toggle</span> <span style="color:blue">[setting]</span> <span style="color:purple">[value1] [value2]<span style="color:red">"</span></span>
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
bind <span style="color:green">[key]</span> <span style="color:red">"</span><span style="color:magenta">+toggle</span> <span style="color:blue">[setting]</span> <span style="color:purple">[value1] [value2]<span style="color:red">"</span></span>
Toggles only work for client settings.  They cannot be used for client or chat commands.
</div>
 
 
<div lang="en" dir="ltr" class="mw-content-ltr">
====Say====
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
Say is an important client command for binding.  It allows you to incorporate chat commands into a bind as well as just send text to the chat.
bind <span style="color:green">[key]</span> <span style="color:magenta">say</span> <span style="color:blue">/[chat command]</span>
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
bind <span style="color:green">[key]</span> <span style="color:magenta">say</span> <span style="color:blue">[chat message]</span>
</div>
 
 
<div lang="en" dir="ltr" class="mw-content-ltr">
====Colors====
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
Some client commands allow you to set colors.
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
*'''player_color_body'''
*'''player_color_body'''
*'''player_color_feet'''
*'''player_color_feet'''
*'''cl_message_client_color'''
*'''cl_message_client_color'''
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
are a few examples.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
To get the correct color values, go to '''Settings > Tee''', and use the sliders to find the color you want.  Go into the console and type the command for the color you're trying to set, by itself with no value.  The number that comes after "'''Value:'''" is the relevant number.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
[[File:Colors.png|File:Colors.png]]
</div>


想知道您所要的颜色参数,您可先在设定内调好,再在F1控制台内查询。例如在 设置> Tee 里将本体身体颜色调成绿色后,可以在控制台内使用与其所对应的客户端指令<code>player_color_body
<div lang="en" dir="ltr" class="mw-content-ltr">
</code>,所返回在'''Value:'''后的一串数字则是您所调的绿色的参数。
<span style="color:blue">player_color_body</span> <span style="color:purple">5635840</span>
[[File:Colors.png]]
or, if you prefer to use the hexadecimal value:
<span style="color:blue">player_color_body</span> <span style="color:purple">$00FF00</span>
It will also accept a few color values by name. '''red''', '''yellow''', '''green''', '''cyan''', '''blue''', '''magenta''', '''white, gray, black''' all work.
</div>


然后您可使用以下绑定快速设置颜色:
bind {{color|green|[按键]}} {{color|blue|player_color_body}} {{color|purple|5635840}}
或者使用十六进制代码:
bind {{color|green|[按键]}} {{color|blue|player_color_body}} {{color|purple|$00FF00}}
客户端也支持直接使用某些颜色名:'''red''','''yellow''','''green''','''cyan''','''blue''','''magenta''','''white''','''gray''',''' black'''。


====表情====
<div lang="en" dir="ltr" class="mw-content-ltr">
表情(英语:emote)指令可以让您在不使用表情选择器下快速发出表情。
====Emotes====
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
The '''emote''' command can be used to display emotes without using the emote wheel.  Each emote is represented by a different number.
[[File:Emotes.png|right|frameless]]
[[File:Emotes.png|right|frameless]]
{| class="wikitable"
{| class="wikitable"
|+
|emote 0
|oop
|-
|-
! 指令与参数 !! 表情解释 !! 英语原文
|emote 1
| exclamation
|-
|-
|emote 0 || 哎呀 || oop
|emote 2
|hearts
|-
|-
|emote 1 || 惊叹 || exclamation
|emote 3
|drop
|-
|-
|emote 2 || 爱心 || hearts
|emote 4
|dotdot
|-
|-
|emote 3 || 流汗 || drop
| emote 5
|music
|-
|-
|emote 4 || 无语 || dotdot
|emote 6
|sorry
|-
|-
|emote 5 || 哼歌 || music
|emote 7
|ghost
|-
|-
|emote 6 || 抱歉 || sorry
|emote 8
|sushi
|-
|-
|emote 7 || 鬼魂 || ghost
|emote 9
|splattee
|-
|-
|emote 8 || 发怒 || sushi
|emote 10
|deviltee
|-
|-
|emote 9 || 谩骂Tee || splattee
|emote 11
|zomg
|-
|-
|emote 10|| 魔鬼Tee || deviltee
|emote 12
|zzz
|-
|-
|emote 11|| 粗鄙之语 || zomg
|emote 13
|wtf
|-
|-
|emote 12|| 打哈欠 || zzz
|emote 14
|eyes
|-
|-
|emote 13|| 什么鬼 ||wtf
|emote 15
|-
| question
|emote 14|| 笑脸 || eyes
|-
|emote 15|| 疑问 ||question
|}
|}
</div>


假如您想发出鬼魂表情时,您要输入:
bind {{color|green|[按键]}} {{color|blue|emote}} {{color|purple|14}}


====其它====
<div lang="en" dir="ltr" class="mw-content-ltr">
如果您想知道某个按键的绑定,输入:
For example:
  binds {{color|green|[按键]}}
  bind <span style="color:green">h</span> <span style="color:blue">emote</span> <span style="color:purple">14</span>
当您不输入按键时,则会显示所有按键的绑定。
</div>


如果您想取消某个按键的绑定,输入:
unbind {{color|green|[按键]}}


==使用配置文件==
<div lang="en" dir="ltr" class="mw-content-ltr">
===语法===
====Other====
对于更复杂的绑定,您可以创建并使用配置文件。
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
binds <span style="color:blue">[key]</span>
You can use this command to print what's bound to a single key.  Use it without a key at the end to get a full list of all your current binds.
unbind <span style="color:blue">[key]</span>
Will unbind whatever key you specify.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
==Using Config Files==
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
===Syntax===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
For more complicated binds, you can make text files containing settings/commands that get executed via a key press.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
'''settings.cfg'''
'''settings.cfg'''
  {{color|blue|[设置/指令]}} {{color|purple|[参数]}}
  <span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span>
  {{color|blue|[设置/指令]}} {{color|purple|[参数]}}
  <span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span>
  {{color|blue|[设置/指令]}} {{color|purple|[参数]}}{{color|red|;}} {{color|blue|[设置/指令]}} {{color|purple|[参数]}}
  <span style="color:blue">[command/setting] <span style="color:purple">[value]</span><span style="color:red">;</span> [command/setting]</span> <span style="color:purple">[value]</span>
  {{color|blue|[设置/指令]}} {{color|purple|[参数]}}{{color|red|;}} {{color|blue|[设置/指令]}} {{color|purple|[参数]}}
  <span style="color:blue">[command/setting] <span style="color:purple">[value]</span><span style="color:red">;</span> [command/setting]</span> <span style="color:purple">[value]</span>
   
   
  bind {{color|green|[按键]}} {{color|blue|[设置/指令]}} {{color|purple|[参数]}}
  bind <span style="color:green">[key]</span> <span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span>
  bind {{color|green|[按键]}} {{color|magenta|exec}} {{color|blue|[文件名.cfg]}}
  bind <span style="color:green">[key]</span> <span style="color:magenta">exec</span> <span style="color:blue">[file.cfg]</span>
如上,在配置文件里,多条设置/指令可以以分号或分行分隔开。您可将您所要的设置/指令/绑定都写在单个配置文件里,然后将其绑定在按键上:
Settings/commands can be chained together via a  semicolon or by just using a new line. You can put as many commands/settings/binds as you want in these files.
  bind {{color|green|[按键]}} {{color|blue|[settings.cfg]}}
</div>


'''备注''':后缀名'''.cfg'''可以更改为任何您想要的后缀名。
<div lang="en" dir="ltr" class="mw-content-ltr">
'''Note:''' You don't need to use '''.cfg''' as the extension.  You can actually use any file extension you want. .'''cfg''' just seems to be the standard.
</div>


===路径与执行===
您需要将配置文件放在配置目录中,有关于配置目录的路径,详见:[[FAQ/zh#《DDNet》的配置文件,配置目录在哪?|《DDNet》的配置文件,配置目录在哪?]]


当您将配置文件放在正确的路径,您可以在F1控制台使用<code>exec</code>指令执行它:
<div lang="en" dir="ltr" class="mw-content-ltr">
bind {{color|green|[按键]}} {{color|magenta|exec}} {{color|blue|[配置文件.cfg]}}
===Path/Exec ===
当您将配置文件放在配置目录下的文件夹中,您需把文件夹的名也给打上:
</div>
bind {{color|green|[按键]}} {{color|magenta|exec}} {{color|blue|[文件夹/to/配置文件.cfg]}}


===进阶切换===
<div lang="en" dir="ltr" class="mw-content-ltr">
配置文件可以让您更容易的切换,您只需要创建两个配置文件:
In order to execute these files, you need to put them in correct directory and execute them with the '''exec''' command.  The correct path depends on your operating system.
</div>


'''配置文件1.cfg'''
 
  {{color|blue|[设置/指令]}} {{color|purple|[参数]}}
<div lang="en" dir="ltr" class="mw-content-ltr">
  {{color|blue|[设置/指令]}} {{color|purple|[参数]}}
======Windows======
  {{color|blue|[设置/指令]}} {{color|purple|[参数]}}
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
%APPDATA%\DDNet
An easier way to find this folder is to press '''win+r''' to open the Run dialog, and paste the path above.
</div>
 
 
<div lang="en" dir="ltr" class="mw-content-ltr">
======MacOS======
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
~/Library/Application\ Support/DDNet
The library folder might be hidden by default.  In Finder, click the '''Go''' menu in the menu bar.  If you hold the '''alt''' key, the Library folder will appear.  You can also press '''cmd''' + '''shift''' + '''g''' to open the "Go to folder" menu, and paste the path above.
</div>
 
 
<div lang="en" dir="ltr" class="mw-content-ltr">
======Linux======
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
~/.DDNet
'''Note:''' as of DDNet version 16.1, the new config directory is called '''DDNet'''.  In previous versions it was called '''Teeworlds'''.  The old '''Teeworlds''' directories still work as a fallback.  For example, the old config directory for windows was:
%APPDATA%\Teeworlds
</div>
 
 
<div lang="en" dir="ltr" class="mw-content-ltr">
Once the files are in the correct path, you can execute them in the game console with the '''exec''' command.
<span style="color:magenta">exec</span> <span style="color:blue">[file.cfg]</span>
or
bind <span style="color:green">[key]</span> <span style="color:magenta">exec</span> <span style="color:blue">[file.cfg]</span>
You can use sub-directories within the 'Teeworlds' directory to organize files.  Just include the path when you execute the file.
bind <span style="color:green">[key]</span> <span style="color:magenta">exec</span> <span style="color:blue">[path/to/file.cfg]</span>
</div>
 
 
 
<div lang="en" dir="ltr" class="mw-content-ltr">
=== Improved toggle with config files===
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
The most common reason to use config files is to create a single-key toggle to alternate between two files.
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
'''file1.cfg'''
  <span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span>
  <span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span>
  <span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span>
   
   
  bind {{color|green|[按键]}} {{color|magenta|exec}} {{color|blue|配置文件2.cfg}}
  bind <span style="color:green">[key]</span> <span style="color:magenta">exec</span> <span style="color:blue">file2.cfg</span>
'''配置文件2.cfg'''
'''file2.cfg'''
  {{color|blue|[设置/指令]}} {{color|purple|[参数]}}
  <span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span>
  {{color|blue|[设置/指令]}} {{color|purple|[参数]}}
  <span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span>
  {{color|blue|[设置/指令]}} {{color|purple|[参数]}}
  <span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span>
   
   
  bind {{color|green|[按键]}} {{color|magenta|exec}} {{color|blue|配置文件1.cfg}}
  bind <span style="color:green">[key]</span> <span style="color:magenta">exec</span> <span style="color:blue">file1.cfg</span>
在两个配置文件里的[按键]需为同一按键。将其中一个配置文件绑定到[按键]中:
In this case, '''[key]''' would be the same key in both files.  This way each time you press the key, it will switch to the other file. Once you have both of these files in the correct path, you can '''exec''' either one just once and they will be bound forever until you unbind them.
  bind {{color|green|[按键]}} {{color|magenta|exec}} {{color|blue|配置文件1.cfg}}
  bind <span style="color:green">[key]</span> <span style="color:magenta">exec</span> <span style="color:blue">file1.cfg</span>
这样您每按一次按键,都会执行相对配置文件的设置/指令并将按键绑定为另一个配置文件,以此达到循环切换。您还可以在此循环内加入更多的配置文件。
You can use this method to cycle between any amount of files.
</div>


===自定义===
 
====回应====
<div lang="en" dir="ltr" class="mw-content-ltr">
回应(英语:echo)指令可以让您更清楚的了解您执行了什么设置/指令。
===Customization===
  [设置/指令] [参数]
</div>
  [设置/指令] [参数]
 
 
<div lang="en" dir="ltr" class="mw-content-ltr">
====Echo====
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
As a more clear way to show which file you're activating when you press a bind, you can use the '''echo''' command to display which one is active.
  [command/setting] [value]
  [command/setting] [value]
   
   
  {{color|blue|echo}} {{color|purple|设置开}}
  <span style="color:blue">echo</span> <span style="color:purple">setting ON</span>
   
   
  bind [按键] exec 配置文件1.cfg
  bind [key] exec file1.cfg
这样当您按下[按键]时,聊天框会显示“设置开”。
To take this a step further, there is a command to change the color of the echo messages.
 
  [command/setting] [value]
您更可以加上颜色:
  [command/setting] [value]
  [设置/指令] [参数]
  [设置/指令] [参数]
   
   
  {{color|blue|cl_message_client_color}} {{color|purple|red}}
  <span style="color:blue">cl_message_client_color</span> <span style="color:purple">red</span>
  {{color|blue|echo}} {{color|purple|设置关}}
  <span style="color:blue">echo</span> <span style="color:purple">setting OFF</span>
   
   
  bind [按键] exec 配置文件1.cfg
  bind [key] exec file1.cfg
这样当您按下[按键]时,聊天框会显示“{{color|red|设置关}}”。
Having different colors for "on" and "off" binds makes it a bit easier to notice which setting you've activated.  If you want to get more creative with colors, see [https://wiki.ddnet.org/wiki/Binds#Colors colors].
</div>
 


将开关定为不同的颜色,可方便您了解您执行了什么设置/指令。
<div lang="en" dir="ltr" class="mw-content-ltr">
====Comments====
</div>


====注释====
<div lang="en" dir="ltr" class="mw-content-ltr">
在配置文件里,您可使用注释:
You can put comments in your bind files too.
</div>


  {{color|purple|# 以下为设置/指令}}
  <div lang="en" dir="ltr" class="mw-content-ltr">
  [设置/指令] [参数]
<span style="color:purple"># These lines change some settings</span>
  [设置/指令] [参数]
  [command/setting] [value]
  [command/setting] [value]
   
   
  {{color|purple|# 以下为将按键绑定为另一配置文件}}
  <span style="color:purple"># This next line rebinds the key</span>
  bind [按键] exec 配置文件1.cfg
  bind [key] exec file1.cfg
</div>
 


==实用绑定==
<div lang="en" dir="ltr" class="mw-content-ltr">
===辅助线常开===
==Examples==
<code>cl_show_hook_coll_own</code>指令能让您在不用<code>+showhookcoll</code>绑定(默认为{{key press|S}}键)下显示辅助线。当您将其参数设为<code>2</code>时,您的辅助线会对您常显示(其他玩家不会看见)。
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
===Hook line always on===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
The command '''cl_show_hook_coll_own''', sets whether you will see your own hook collision line or not when you hold your '''+showhookcoll''' bind (defaulted to '''S''').  When set to '''2''', your hook collision line will always show only to you.  Others players won't see it.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
'''hook_line_on.cfg'''
'''hook_line_on.cfg'''
  {{color|blue|cl_show_hook_coll_own}} {{color|purple|2}}
  <span style="color:blue">cl_show_hook_coll_own</span> <span style="color:purple">2</span>
   
   
  {{color|blue|cl_message_client_color}} {{color|purple|green}}
  <span style="color:purple"><span style="color:blue">cl_message_client_color</span> <span style="color:purple">green</span>
  {{color|blue|echo}} {{color|purple|Hook Line ON}}
  <span style="color:blue">echo</span> <span style="color:purple">Hook Line ON</span>
   
   
  bind {{color|green|x}} {{color|magenta|exec}} {{color|blue|hook_line_off.cfg}}
  bind <span style="color:green">x</span> <span style="color:magenta">exec</span> <span style="color:blue">hook_line_off.cfg</span>
'''hook_line_off.cfg'''
'''hook_line_off.cfg'''
  {{color|blue|cl_show_hook_coll_own}} {{color|purple|1}}
  <span style="color:blue">cl_show_hook_coll_own</span> <span style="color:purple">1</span>
   
   
  {{color|blue|cl_message_client_color}} {{color|purple|red}}
  <span style="color:purple"><span style="color:blue">cl_message_client_color</span> <span style="color:purple">red</span>
  {{color|blue|echo}} {{color|purple|Hook Line OFF}}
  <span style="color:blue">echo</span> <span style="color:purple">Hook Line OFF</span>
   
   
  bind {{color|green|x}} {{color|magenta|exec}} {{color|blue|hook_line_on.cfg}}
  bind <span style="color:green">x</span> <span style="color:magenta">exec</span> <span style="color:blue">hook_line_on.cfg</span>
将这两个配置文件放在配置目录里,并在F1控制台输入:
Put both of these in the correct path, and in console:
  bind {{color|green|x}} {{color|magenta|exec}} {{color|blue|hook_line_on.cfg}}
  bind <span style="color:green">x</span> <span style="color:magenta">exec</span> <span style="color:blue">hook_line_on.cfg</span>
</div>


===显示所有玩家辅助线===
<div lang="en" dir="ltr" class="mw-content-ltr">
<code>cl_show_hook_coll_other</code>指令能让您看到所有玩家的辅助线。您可以直接将其添加到默认绑定中:
===Everyone's hooklines===
</div>


bind {{color|green|s}} {{color|red|"}}{{color|blue|+showhookcoll}}{{color|red|;}} {{color|magenta|+toggle}} {{color|blue|cl_show_hook_coll_other}} {{color|purple|2 1}}{{color|red|"}}
<div lang="en" dir="ltr" class="mw-content-ltr">
The command '''cl_show_hook_coll_other''' allows you to see other tee's hooklines, which can be useful when they are out of your view.
You can add this to the basic hookline bind to "upgrade" it:
</div>


===深度冻结飞行===
<div lang="en" dir="ltr" class="mw-content-ltr">
所谓的深度冻结飞行(英语:Deep Fly)绑定可以让您的分身朝您锤击/开火。如果您的分身处于深度冻结状态,您使用此绑定锤击它时,它们也会锤击您。以此,在练习后您可与在深度冻结状态下的分身飞行(某些地图会设置成深度冻结状态下不能锤击/开火)。而如果没有被深度冻结,您也可以以此绑定取代默认的Hammerfly绑定,这能让您更好的控制分身锤击时间。
'''cl_show_hook_coll_other'''
bind <span style="color:green">x</span> <span style="color:red">"</span><span style="color:blue">+showhookcoll</span><span style="color:red">;</span> <span style="color:magenta">+toggle</span> <span style="color:blue">cl_show_hook_coll_other</span> <span style="color:purple">2 1</span><span style="color:red">"</span>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
===Deep Fly ===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
The deep fly bind is a way to make your dummy hammer/fire toward you whenever you fire with your main tee.  If your dummy is deep frozen, they can hammer back at you when you hammer them with this bind on. You can use this to fly with your dummy, but it takes practice.  If your dummy is not deep frozen, you can just use this as a alternative version of the regular Dummy Hammerfly bind included in the games settings, where you can fire your pistol each time you want to be hammered.  It offers better control since you can control the timing of your dummy's hammers.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
[[File:Deepfly webm.webm|351x198px|gif]]
[[File:Deepfly webm.webm|351x198px|gif]]
</div>


<code>cl_dummy_hammer 1</code>是一般在设置里的分身Hammerfly绑定。使用[[#切换|切换]]就能达到在按下按键时,分身才锤击的效果,如下:
<div lang="en" dir="ltr" class="mw-content-ltr">
The command '''cl_dummy_hammer 1''' is what is used for the regular Dummy Hammerfly bind in the games control options.  By using a [https://wiki.ddnet.org/wiki/Binds#Toggles toggle], you can make your dummy hammer you only when you fire, and can make an on/off switch with config files.
</div>


====使用两个配置文件====
 
<div lang="en" dir="ltr" class="mw-content-ltr">
====Using 2 Config Files====
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
'''deepfly_on.cfg'''
'''deepfly_on.cfg'''
  bind {{color|green|mouse1}} {{color|red|"}}{{color|blue|+fire}}{{color|red|;}} {{color|magenta|+toggle}} {{color|blue|cl_dummy_hammer}} {{color|purple|1 0}}{{color|red|"}}
  bind <span style="color:green">mouse1</span> <span style="color:red">"</span><span style="color:blue">+fire</span><span style="color:red">;</span> <span style="color:magenta">+toggle</span> <span style="color:blue">cl_dummy_hammer</span> <span style="color:purple">1 0<span style="color:red">"</span>
   
   
  {{color|blue|cl_message_client_color}} {{color|purple|green}}
  <span style="color:blue">cl_message_client_color</span> <span style="color:purple">green</span>
  {{color|blue|echo}} {{color|purple|Deep Fly ON}}
  <span style="color:blue">echo</span> <span style="color:purple">Deep Fly ON</span>
   
   
  bind {{color|green|x}} {{color|magenta|exec}} {{color|blue|deepfly_off.cfg}}
  bind <span style="color:green">x</span> <span style="color:magenta">exec</span> <span style="color:blue">deepfly_off.cfg</span>
'''deepfly_off.cfg'''
'''deepfly_off.cfg'''
  bind {{color|green|mouse1}} {{color|blue|+fire}}
  bind <span style="color:green">mouse1</span> <span style="color:blue">+fire</span>
  {{color|blue|cl_dummy_hammer}} {{color|purple|0}}
  <span style="color:blue">cl_dummy_hammer</span> <span style="color:purple">0</span>
   
   
  {{color|blue|cl_message_client_color}} {{color|purple|red}}
  <span style="color:blue">cl_message_client_color</span> <span style="color:purple">red</span>
  {{color|blue|echo}} {{color|purple|Deep Fly OFF}}
  <span style="color:blue">echo</span> <span style="color:purple">Deep Fly OFF</span>
   
   
  bind {{color|green|x}} {{color|magenta|exec}} {{color|blue|deepfly_on.cfg}}
  bind <span style="color:green">x</span> <span style="color:magenta">exec</span> <span style="color:blue">deepfly_on.cfg</span>
将这两个配置文件放在配置目录里,并在F1控制台输入:
Put both of these in the correct path, and in console:
  bind {{color|green|x}} {{color|magenta|exec}} {{color|blue|deepfly_on.cfg}}
  bind <span style="color:green">x</span> <span style="color:magenta">exec</span> <span style="color:blue">deepfly_on.cfg</span>
</div>
 
 
<div lang="en" dir="ltr" class="mw-content-ltr">
====Using 1 Config File====
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
You can accomplish the same thing as above using only 1 config file.
</div>


====使用单个配置文件====
<div lang="en" dir="ltr" class="mw-content-ltr">
您也可以将以上两个配置文件整合:
bind <span style="color:green">x</span> <span style="color:red">"</span>bind <span style="color:green">mouse1</span> <span style="color:orange">\</span><span style="color:red">"</span><span style="color:blue">+fire</span><span style="color:red">;</span> <span style="color:blue"><span style="color:magenta">+toggle</span> cl_dummy_hammer</span> <span style="color:purple">1 0</span><span style="color:orange">\</span><span style="color:red">";</span><span style="color:blue">cl_message_client_color <span style="color:purple">green</span></span><span style="color:red">;</span> <span style="color:blue">echo</span> <span style="color:purple">Deep Fly ON</span><span style="color:red">;</span> bind <span style="color:green">x</span> <span style="color:orange">\</span><span style="color:red">"</span>bind <span style="color:green">mouse1</span> <span style="color:blue">+fire</span><span style="color:red">;</span> <span style="color:blue">cl_dummy_hammer</span> <span style="color:purple">0</span><span style="color:red">;</span> <span style="color:blue">cl_message_client_color</span> <span style="color:purple">red</span><span style="color:red">;</span> <span style="color:blue">echo</span> <span style="color:purple">Deep Fly OFF</span><span style="color:red">;</span> <span style="color:magenta">exec</span> <span style="color:blue">deepfly.cfg</span><span style="color:orange">\</span><span style="color:red">""</span>
bind {{color|green|x}} {{color|red|"}}bind {{color|green|mouse1}} {{color|orange|\}}{{color|red|"}}{{color|blue|+fire}}{{color|red|;}} {{color|blue|{{color|magenta|+toggle}} cl_dummy_hammer}} {{color|purple|1 0}}{{color|orange|\}}{{color|red|";}}{{color|blue|cl_message_client_color}} {{color|purple|green}}{{color|red|;}} {{color|blue|echo}} {{color|purple|Deep Fly ON}}{{color|red|;}} bind {{color|green|x}} {{color|orange|\}}{{color|red|"}}bind {{color|green|mouse1}} {{color|blue|+fire}}{{color|red|;}} {{color|blue|cl_dummy_hammer}} {{color|purple|0}}{{color|red|;}} {{color|blue|cl_message_client_color}} {{color|purple|red}}{{color|red|;}} {{color|blue|echo}} {{color|purple|Deep Fly OFF}}{{color|red|;}} {{color|magenta|exec}} {{color|blue|deepfly.cfg}}{{color|orange|\}}{{color|red|""}}
Put this file in the correct path, and in console:
将这个配置文件放在配置目录里,并在F1控制台输入:
  bind <span style="color:green">x</span> <span style="color:magenta">exec</span> <span style="color:blue">deepfly.cfg</span>
  bind {{color|green|x}} {{color|magenta|exec}} {{color|blue|deepfly.cfg}}
</div>


'''备注一''':配置文件中假定了您的<code>+fire</code>(开火)绑定在{{key press|mouse1}} (鼠标左键)上。
<div lang="en" dir="ltr" class="mw-content-ltr">
'''Note 1:''' This assumes mouse1 is your '''+fire''' bind.
</div>


'''备注二''':如果您使用单个配置文件,在您按住开火键时关闭绑定的话,会出现所谓卡键的情况,因为您的<code>cl_dummy_hammer</code>指令参数固定为<code>1</code>。您只能通过使用两个配置文件解决。
<div lang="en" dir="ltr" class="mw-content-ltr">
'''Note 2:''' If you turn deep fly off while you're holding your '''+fire''' bind, your dummy will get stuck in a hammering rhythm since '''cl_dummy_hammer''' is set to '''1''' still.  The  '''cl_dummy_hammer 0''' line in '''deepfly_off.cfg''' fixes this.
</div>


====武器切换====
{{color|blue|cl_dummy_restore_weapon}} {{color|purple|1}}
您的设置默认为以上,因此当您的分身并非拿着锤子而您去使用深度冻结飞行绑定时会出现如视频中的情况,这有一定的好处。


<div lang="en" dir="ltr" class="mw-content-ltr">
====Weapon Swapping====
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
If your dummy isn't holding hammer when you turn the bind on, they will switch back and forth between pistol and hammer.  If you want to fix this:
<span style="color:blue">cl_dummy_restore_weapon</span> <span style="color:purple">0</span>
Now if they're holding pistol when you start using the bind, they will switch to hammer and stay there after 1 pistol shot.  There are however some benefits of having this setting set to '''1'''.
<span style="color:blue">cl_dummy_restore_weapon</span> <span style="color:purple">1</span>
This will allow you to laser yourself with your dummy with perfect aim.  It can also be useful with shotgun.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
[[File:Deepfly laser example.webm|351x198px|gif]]
[[File:Deepfly laser example.webm|351x198px|gif]]
</div>


您可以将参数更改为<code>0</code>,让分身武器自动切换为锤子:
<div lang="en" dir="ltr" class="mw-content-ltr">
{{color|blue|cl_dummy_restore_weapon}} {{color|purple|0}}
To manage dealing with both of these settings, you can either create a [https://wiki.ddnet.org/wiki/Binds#Toggles toggle], use [https://wiki.ddnet.org/wiki/Binds#Using_Config_Files config files], or have this setting attached to your weapon binds.
bind <span style="color:green">[key]</span> <span style="color:blue"><span style="color:red">"</span>+weapon1<span style="color:red">;</span></span> <span style="color:blue">cl_dummy_restore_weapon</span> <span style="color:red">0"</span>
</div>


您也可以自行运用[[#切换|切换]]或者[[#使用配置文件|配置文件]]
<div lang="en" dir="ltr" class="mw-content-ltr">
bind {{color|green|[按键]}} {{color|blue|{{color|red|"}}+weapon1{{color|red|;}}}} {{color|blue|cl_dummy_restore_weapon}} {{color|red|0"}}
bind <span style="color:green">[key]</span> <span style="color:blue"><span style="color:red">"</span>+weapon5<span style="color:red">;</span></span> <span style="color:blue">cl_dummy_restore_weapon</span> <span style="color:red">1"</span>
This of course only works if you have dedicated weapon binds as opposed to '''+nextweapon''' and '''+prevweapon''' which is by default bound to '''mousewheelup''' and '''mousewheeldown'''.
</div>


bind {{color|green|[按键]}} {{color|blue|{{color|red|"}}+weapon5{{color|red|;}}}} {{color|blue|cl_dummy_restore_weapon}} {{color|red|1"}}


'''备注''':请谨记不要使用<code>+nextweapon</code>和<code>+prevweapon</code>(默认绑定为鼠标滚轮向上和鼠标滚轮向下中)切换武器,否则将出现武器乱切换的情况。
<div lang="en" dir="ltr" class="mw-content-ltr">
===45° Aiming===
</div>


===45度角===
<div lang="en" dir="ltr" class="mw-content-ltr">
这个绑定能让您锁死角度,只剩下八个方向(每45度):
This bind allows you to only aim in 45° angles when holding down the key.  This is useful for shooting rockets straight up for double rockets and a few other scenarios.
  bind {{color|green|x}} {{color|red|"}}{{color|magenta|+toggle}} {{color|blue|cl_mouse_max_distance}} {{color|purple|2 400}}{{color|red|;}} {{color|magenta|+toggle}} {{color|blue|inp_mousesens}} {{color|purple|1 200}}{{color|red|;}} {{color|blue|+showhookcoll}}{{color|red|"}}
  bind <span style="color:green">x</span> <span style="color:red">"</span><span style="color:magenta">+toggle</span> <span style="color:blue">cl_mouse_max_distance</span> <span style="color:purple">2 400<span style="color:red">;</span> <span style="color:magenta">+toggle</span> <span style="color:blue">inp_mousesens</span> <span style="color:purple">1 200</span><span style="color:red">;</span> <span style="color:blue">+showhookcoll</span><span style="color:purple"><span style="color:red">"</span>
您需要在F1控制台输入<code>cl_mouse_max_distance</code>查询参数,并将<code>400</code>替换成查询参数;以及在F1控制台输入<code>inp_mousesens</code>查询参数,并将<code>200</code>替换成查询参数:
Keep in mind that if you have changed '''cl_mouse_max_distance''' or '''inp_mousesens''' from the default, using the example above will reset those settings to default.  Before you just enter the binds, check your settings for both first by typing '''cl_mouse_max_distance''' and '''inp_mousesens''' into the console.
  bind {{color|green|x}} {{color|red|"}}{{color|magenta|+toggle}} {{color|blue|cl_mouse_max_distance}} {{color|purple|2 [您的参数]}}{{color|red|;}} {{color|magenta|+toggle}} {{color|blue|inp_mousesens}} {{color|purple|1 [您的参数]}}{{color|red|;}} {{color|blue|+showhookcoll}}{{color|red|"}}
  bind <span style="color:green">x</span> <span style="color:red">"</span><span style="color:magenta">+toggle</span> <span style="color:blue">cl_mouse_max_distance</span> <span style="color:purple">2 [Your Value]<span style="color:red">;</span> <span style="color:magenta">+toggle</span> <span style="color:blue">inp_mousesens</span> <span style="color:purple">1 [Your Value]</span><span style="color:red">;</span> <span style="color:blue">+showhookcoll</span><span style="color:purple"><span style="color:red">"</span>
'''Note:''' the '''+showhookcoll''' line is optional, it's just helpful to see which way you're aiming since your tee's eyes don't follow the 45° constraints.
</div>


===变色Tee===
 
要达到变色的效果,你需要将<code>player_color_body</code>指令绑定到移动或操作键上,例如:
<div lang="en" dir="ltr" class="mw-content-ltr">
  bind {{color|green|a}} {{color|blue|{{color|red|"}}+left{{color|red|;}} player_color_body}} {{color|red|red"}}
===Rainbow Tee===
绑定到不同的移动和操作键上,达到循环变色的效果,并且使用配置文件,方便开关。以下为一组例子:
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
You will sometimes see players rapidly changing color as they play.  To do this you just have to bind a '''player_color_body''' change to each of your regular movement inputs.
bind <span style="color:green">a</span> <span style="color:blue"><span style="color:red">"</span>+left<span style="color:red">;</span> player_color_body</span> <span style="color:red">red"</span>
You can do this for several common inputs and get a variety of to cycle through.
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
'''rainbow_tee.cfg'''
  bind <span style="color:green">a</span> <span style="color:blue"><span style="color:red">"</span>+left<span style="color:red">;</span> player_color_body</span> <span style="color:red">red"</span>
bind <span style="color:green">d</span> <span style="color:blue"><span style="color:red">"</span>+right<span style="color:red">;</span> player_color_body</span> <span style="color:red">yellow"</span>
bind <span style="color:green">space</span> <span style="color:blue"><span style="color:red">"</span>+jump<span style="color:red">;</span> player_color_body</span> <span style="color:red">green"</span>
bind <span style="color:green">mouse1</span> <span style="color:blue"><span style="color:red">"</span>+fire<span style="color:red">;</span> player_color_body</span> <span style="color:red">blue"</span>
bind <span style="color:green">mouse2</span> <span style="color:blue"><span style="color:red">"</span>+hook<span style="color:red">;</span> player_color_body</span> <span style="color:red">cyan"</span>
Here's an example of what a rainbow tee file looks like.  You could save that in the correct path and execute it once.
<span style="color:magenta">exec</span> <span style="color:blue">rainbow_tee.cfg</span>
Or if you want a key to toggle it on and off:
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
'''rainbow_tee_on.cfg'''
'''rainbow_tee_on.cfg'''
  bind {{color|green|a}} {{color|blue|{{color|red|"}}+left{{color|red|;}} player_color_body}} {{color|red|red"}}
  bind <span style="color:green">a</span> <span style="color:blue"><span style="color:red">"</span>+left<span style="color:red">;</span> player_color_body</span> <span style="color:red">red"</span>
  bind {{color|green|d}} {{color|blue|{{color|red|"}}+right{{color|red|;}} player_color_body}} {{color|red|yellow"}}
  bind <span style="color:green">d</span> <span style="color:blue"><span style="color:red">"</span>+right<span style="color:red">;</span> player_color_body</span> <span style="color:red">yellow"</span>
  bind {{color|green|space}} {{color|blue|{{color|red|"}}+jump{{color|red|;}} player_color_body}} {{color|red|green"}}
  bind <span style="color:green">space</span> <span style="color:blue"><span style="color:red">"</span>+jump<span style="color:red">;</span> player_color_body</span> <span style="color:red">green"</span>
  bind {{color|green|mouse1}} {{color|blue|{{color|red|"}}+fire{{color|red|;}} player_color_body}} {{color|red|blue"}}
  bind <span style="color:green">mouse1</span> <span style="color:blue"><span style="color:red">"</span>+fire<span style="color:red">;</span> player_color_body</span> <span style="color:red">blue"</span>
  bind {{color|green|mouse2}} {{color|blue|{{color|red|"}}+hook{{color|red|;}} player_color_body}} {{color|red|cyan"}}
  bind <span style="color:green">mouse2</span> <span style="color:blue"><span style="color:red">"</span>+hook<span style="color:red">;</span> player_color_body</span> <span style="color:red">cyan"</span>
   
   
  {{color|purple|bind}} {{color|green|x}} {{color|magenta|exec}} {{color|blue|rainbow_tee_off.cfg}}
  <span style="color:purple">bind <span style="color:green">x</span> <span style="color:magenta">exec</span> <span style="color:blue">rainbow_tee_off.cfg</span>
'''rainbow_tee_off.cfg'''
'''rainbow_tee_off.cfg'''
  bind {{color|green|a}} {{color|blue|+left}}
  bind <span style="color:green">a</span> <span style="color:blue">+left</span>
  bind {{color|green|d}} {{color|blue|+right}}
  bind <span style="color:green">d</span> <span style="color:blue">+right</span>
  bind {{color|green|space}} {{color|blue|+jump}}
  bind <span style="color:green">space</span> <span style="color:blue">+jump</span>
  bind {{color|green|mouse1}} {{color|blue|+fire}}
  bind <span style="color:green">mouse1</span> <span style="color:blue">+fire</span>
  bind {{color|green|mouse2}} {{color|blue|+hook}}
  bind <span style="color:green">mouse2</span> <span style="color:blue">+hook</span>
   
   
  {{color|purple|bind}} {{color|green|x}} {{color|magenta|exec}} {{color|blue|rainbow_tee_on.cfg}}
  <span style="color:purple">bind <span style="color:green">x</span> <span style="color:magenta">exec</span> <span style="color:blue">rainbow_tee_on.cfg</span>
将这两个配置文件放在配置目录里,并在F1控制台输入:
Put both of these in the correct path, and in console:
  bind {{color|green|x}} {{color|magenta|exec}} {{color|blue|rainbow_tee_on.cfg}}
  bind <span style="color:green">x</span> <span style="color:magenta">exec</span> <span style="color:blue">rainbow_tee_on.cfg</span>
您可以加入<code>player_color_feet</code>指令达到更有趣的变色效果。要了解关于颜色的指令,详见:[[#颜色|颜色]]。
You can of course get more creative with colors and use '''player_color_feet''' too.  To learn more about how colors work, see [https://wiki.ddnet.org/wiki/Binds#Colors colors]
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
'''Note:''' This assumes you have default binds for left, right, jump, fire, and hook.
</div>
 


'''备注''':配置文件中假定了您的的绑定皆为默认绑定。
<div lang="en" dir="ltr" class="mw-content-ltr">
==See also ==
</div>


==另见==
<div lang="en" dir="ltr" class="mw-content-ltr">
*[https://forum.ddnet.org/viewtopic.php?t=2537 Just bind it] - 实用绑定
*[https://forum.ddnet.org/viewtopic.php?t=2537 Just bind it] - Useful binds available for copying
*[https://forum.ddnet.org/viewtopic.php?t=5819 Take Binding to the next level, with Scripting!] - 进阶绑定
*[https://forum.ddnet.org/viewtopic.php?t=5819 Take Binding to the next level, with Scripting!] - Another forum post about more advanced binds
*[https://www.youtube.com/watch?v=sELsw2I2jj8& Teeworlds New Binding Tutorial by Klex] - 玩家KlexMikrowelle绑定的介绍视频
*[https://www.youtube.com/watch?v=sELsw2I2jj8& Teeworlds New Binding Tutorial by Klex] - A video tutorial about binds by KlexMikrowelle
</div>

Revision as of 20:22, 11 February 2023

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.
  • [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

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. You can also use modifier keys with binds.

bind ctrl+[key] [command/setting] [value]

you can use ctrl, alt, shift, and gui. Gui is used to refer to the windows key on windows, the command key on macos/osx, and super/meta on linux.


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]"

It's important to know that when chaining things together like this, all commands/settings get executed by the game at the exact same time, meaning they will not execute sequentially in the order you write them. There is no sleep or delay type command to space things out the way you want them. The best way to make things happen in an ordered sequence is to either bind a different key for each step of the sequence, or to use config files to press one key multiple times to read multiple files.


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 maximum amount of layers you can use is 5 before the console gives you an error. This is because the console has a maximum character limit of 255. The amount of backslashes for 6 layers is 240 (1*2 + 3*2 + 7*2 + 15*2 + 31*2 + 63*2), leaving you with only 15 characters.

1 = 1 \

2 = 3   \\\
3 = 7   \\\\\\\
4 = 15  \\\\\\\\\\\\\\\
5 = 31  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

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]
    \\\\\\\"
   \\\"
  \"
 "


Useful Commands & Settings


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 when the key is released.

bind [key] "toggle [setting] [value1] [value2]"

bind [key] "+toggle [setting] [value1] [value2]" Toggles only work for client settings. They cannot be used for client or chat commands.


Say

Say is an important client command for binding. It allows you to incorporate chat commands into a bind as well as just send text to the chat.

bind [key] say /[chat command]

bind [key] say [chat message]


Colors

Some client commands allow you to set colors.

  • player_color_body
  • player_color_feet
  • cl_message_client_color

are a few examples.

To get the correct color values, go to Settings > Tee, and use the sliders to find the color you want. Go into the console and type the command for the color you're trying to set, by itself with no value. The number that comes after "Value:" is the relevant number.

File:Colors.png

player_color_body 5635840 or, if you prefer to use the hexadecimal value:

player_color_body $00FF00

It will also accept a few color values by name. red, yellow, green, cyan, blue, magenta, white, gray, black all work.


Emotes

The emote command can be used to display emotes without using the emote wheel. Each emote is represented by a different number.

emote 0 oop
emote 1 exclamation
emote 2 hearts
emote 3 drop
emote 4 dotdot
emote 5 music
emote 6 sorry
emote 7 ghost
emote 8 sushi
emote 9 splattee
emote 10 deviltee
emote 11 zomg
emote 12 zzz
emote 13 wtf
emote 14 eyes
emote 15 question


For example:

bind h emote 14


Other

binds [key] You can use this command to print what's bound to a single key. Use it without a key at the end to get a full list of all your current binds.

unbind [key]

Will unbind whatever key you specify.


Using Config Files


Syntax

For more complicated binds, you can make text files containing settings/commands that get executed via a key press.

settings.cfg

[command/setting] [value]
[command/setting] [value]
[command/setting] [value]; [command/setting] [value]
[command/setting] [value]; [command/setting] [value]

bind [key] [command/setting] [value]
bind [key] exec [file.cfg]

Settings/commands can be chained together via a semicolon or by just using a new line. You can put as many commands/settings/binds as you want in these files.

Note: You don't need to use .cfg as the extension. You can actually use any file extension you want. .cfg just seems to be the standard.


Path/Exec

In order to execute these files, you need to put them in correct directory and execute them with the exec command. The correct path depends on your operating system.


Windows

%APPDATA%\DDNet An easier way to find this folder is to press win+r to open the Run dialog, and paste the path above.


MacOS

~/Library/Application\ Support/DDNet The library folder might be hidden by default. In Finder, click the Go menu in the menu bar. If you hold the alt key, the Library folder will appear. You can also press cmd + shift + g to open the "Go to folder" menu, and paste the path above.


Linux

~/.DDNet Note: as of DDNet version 16.1, the new config directory is called DDNet. In previous versions it was called Teeworlds. The old Teeworlds directories still work as a fallback. For example, the old config directory for windows was:

%APPDATA%\Teeworlds


Once the files are in the correct path, you can execute them in the game console with the exec command.

exec [file.cfg]

or

bind [key] exec [file.cfg]

You can use sub-directories within the 'Teeworlds' directory to organize files. Just include the path when you execute the file.

bind [key] exec [path/to/file.cfg]


Improved toggle with config files

The most common reason to use config files is to create a single-key toggle to alternate between two files.

file1.cfg

[command/setting] [value]
[command/setting] [value]
[command/setting] [value]

bind [key] exec file2.cfg

file2.cfg

[command/setting] [value]
[command/setting] [value]
[command/setting] [value]

bind [key] exec file1.cfg

In this case, [key] would be the same key in both files. This way each time you press the key, it will switch to the other file. Once you have both of these files in the correct path, you can exec either one just once and they will be bound forever until you unbind them.

bind [key] exec file1.cfg

You can use this method to cycle between any amount of files.


Customization


Echo

As a more clear way to show which file you're activating when you press a bind, you can use the echo command to display which one is active.

[command/setting] [value]
[command/setting] [value]

echo setting ON

bind [key] exec file1.cfg

To take this a step further, there is a command to change the color of the echo messages.

[command/setting] [value]
[command/setting] [value]

cl_message_client_color red
echo setting OFF

bind [key] exec file1.cfg

Having different colors for "on" and "off" binds makes it a bit easier to notice which setting you've activated. If you want to get more creative with colors, see colors.


Comments

You can put comments in your bind files too.

# These lines change some settings

[command/setting] [value]
[command/setting] [value]

# This next line rebinds the key
bind [key] exec file1.cfg


Examples


Hook line always on

The command cl_show_hook_coll_own, sets whether you will see your own hook collision line or not when you hold your +showhookcoll bind (defaulted to S). When set to 2, your hook collision line will always show only to you. Others players won't see it.

hook_line_on.cfg

cl_show_hook_coll_own 2

cl_message_client_color green
echo Hook Line ON

bind x exec hook_line_off.cfg

hook_line_off.cfg

cl_show_hook_coll_own 1

cl_message_client_color red
echo Hook Line OFF

bind x exec hook_line_on.cfg

Put both of these in the correct path, and in console:

bind x exec hook_line_on.cfg

Everyone's hooklines

The command cl_show_hook_coll_other allows you to see other tee's hooklines, which can be useful when they are out of your view. You can add this to the basic hookline bind to "upgrade" it:

cl_show_hook_coll_other

bind x "+showhookcoll; +toggle cl_show_hook_coll_other 2 1"


Deep Fly

The deep fly bind is a way to make your dummy hammer/fire toward you whenever you fire with your main tee. If your dummy is deep frozen, they can hammer back at you when you hammer them with this bind on. You can use this to fly with your dummy, but it takes practice. If your dummy is not deep frozen, you can just use this as a alternative version of the regular Dummy Hammerfly bind included in the games settings, where you can fire your pistol each time you want to be hammered. It offers better control since you can control the timing of your dummy's hammers.

The command cl_dummy_hammer 1 is what is used for the regular Dummy Hammerfly bind in the games control options. By using a toggle, you can make your dummy hammer you only when you fire, and can make an on/off switch with config files.


Using 2 Config Files

deepfly_on.cfg

bind mouse1 "+fire; +toggle cl_dummy_hammer 1 0"

cl_message_client_color green
echo Deep Fly ON

bind x exec deepfly_off.cfg

deepfly_off.cfg

bind mouse1 +fire
cl_dummy_hammer 0

cl_message_client_color red
echo Deep Fly OFF

bind x exec deepfly_on.cfg

Put both of these in the correct path, and in console:

bind x exec deepfly_on.cfg


Using 1 Config File

You can accomplish the same thing as above using only 1 config file.

bind x "bind mouse1 \"+fire; +toggle cl_dummy_hammer 1 0\";cl_message_client_color green; echo Deep Fly ON; bind x \"bind mouse1 +fire; cl_dummy_hammer 0; cl_message_client_color red; echo Deep Fly OFF; exec deepfly.cfg\"" Put this file in the correct path, and in console:

bind x exec deepfly.cfg

Note 1: This assumes mouse1 is your +fire bind.

Note 2: If you turn deep fly off while you're holding your +fire bind, your dummy will get stuck in a hammering rhythm since cl_dummy_hammer is set to 1 still. The cl_dummy_hammer 0 line in deepfly_off.cfg fixes this.


Weapon Swapping

If your dummy isn't holding hammer when you turn the bind on, they will switch back and forth between pistol and hammer. If you want to fix this:

cl_dummy_restore_weapon 0

Now if they're holding pistol when you start using the bind, they will switch to hammer and stay there after 1 pistol shot. There are however some benefits of having this setting set to 1.

cl_dummy_restore_weapon 1

This will allow you to laser yourself with your dummy with perfect aim. It can also be useful with shotgun.

To manage dealing with both of these settings, you can either create a toggle, use config files, or have this setting attached to your weapon binds.

bind [key] "+weapon1; cl_dummy_restore_weapon 0"

bind [key] "+weapon5; cl_dummy_restore_weapon 1" This of course only works if you have dedicated weapon binds as opposed to +nextweapon and +prevweapon which is by default bound to mousewheelup and mousewheeldown.


45° Aiming

This bind allows you to only aim in 45° angles when holding down the key. This is useful for shooting rockets straight up for double rockets and a few other scenarios.

bind x "+toggle cl_mouse_max_distance 2 400; +toggle inp_mousesens 1 200; +showhookcoll"

Keep in mind that if you have changed cl_mouse_max_distance or inp_mousesens from the default, using the example above will reset those settings to default. Before you just enter the binds, check your settings for both first by typing cl_mouse_max_distance and inp_mousesens into the console.

bind x "+toggle cl_mouse_max_distance 2 [Your Value]; +toggle inp_mousesens 1 [Your Value]; +showhookcoll"

Note: the +showhookcoll line is optional, it's just helpful to see which way you're aiming since your tee's eyes don't follow the 45° constraints.


Rainbow Tee

You will sometimes see players rapidly changing color as they play. To do this you just have to bind a player_color_body change to each of your regular movement inputs.

bind a "+left; player_color_body red"

You can do this for several common inputs and get a variety of to cycle through.

rainbow_tee.cfg

bind a "+left; player_color_body red"
bind d "+right; player_color_body yellow"
bind space "+jump; player_color_body green"
bind mouse1 "+fire; player_color_body blue"
bind mouse2 "+hook; player_color_body cyan"

Here's an example of what a rainbow tee file looks like. You could save that in the correct path and execute it once.

exec rainbow_tee.cfg

Or if you want a key to toggle it on and off:

rainbow_tee_on.cfg

bind a "+left; player_color_body red"
bind d "+right; player_color_body yellow"
bind space "+jump; player_color_body green"
bind mouse1 "+fire; player_color_body blue"
bind mouse2 "+hook; player_color_body cyan"

bind x exec rainbow_tee_off.cfg

rainbow_tee_off.cfg

bind a +left
bind d +right
bind space +jump
bind mouse1 +fire
bind mouse2 +hook

bind x exec rainbow_tee_on.cfg

Put both of these in the correct path, and in console:

bind x exec rainbow_tee_on.cfg

You can of course get more creative with colors and use player_color_feet too. To learn more about how colors work, see colors

Note: This assumes you have default binds for left, right, jump, fire, and hook.


See also