User:By/draft: Difference between revisions

From DDraceNetwork
By (talk | contribs)
No edit summary
By (talk | contribs)
No edit summary
Line 5: Line 5:


===单指令绑定===
===单指令绑定===
  bind <span style="color:green">[按键]</span> <span style="color:blue">[设置/指令]</span> <span style="color:purple">[参数]</span>
  bind {{color|green|[按键]}} {{color|blue|[设置/指令]}} {{color|purple|[参数]}}


此为绑定的基本语法。
此为绑定的基本语法。
Line 12: Line 12:
*'''[参数]''':您想要调整的设置或指令的变量或参数。(仅有某些设置需要使用参数,指令和某些设置无需参数)
*'''[参数]''':您想要调整的设置或指令的变量或参数。(仅有某些设置需要使用参数,指令和某些设置无需参数)
倘若您不知道某个按键的名称,可以在[https://github.com/ddnet/ddnet/blob/master/src/engine/client/keynames.h 这个页面]中查找,亦或者在游戏设置 > 控制中随意找一格按下你想要的按键,即会显示按键名称。您也可以与修饰键{{key press|ctrl}},{{key press|shift}}和{{key press|alt}}一起使用,如下:
倘若您不知道某个按键的名称,可以在[https://github.com/ddnet/ddnet/blob/master/src/engine/client/keynames.h 这个页面]中查找,亦或者在游戏设置 > 控制中随意找一格按下你想要的按键,即会显示按键名称。您也可以与修饰键{{key press|ctrl}},{{key press|shift}}和{{key press|alt}}一起使用,如下:
  bind <span style="color:magenta">ctrl+</span><span style="color:green">[按键]</span> <span style="color:blue">[设置/指令]</span> <span style="color:purple">[参数]</span>
  bind {{color|magenta|ctrl+}}{{color|green|[按键]}} {{color|blue|[设置/指令]}} {{color|purple|[参数]}}


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


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


  1 = 1  <span style="color:orange">\</span>
  1 = 1  {{color|orange|\}}
  2 = 3  <span style="color:orange">\\\</span>
  2 = 3  {{color|orange|\\\}}
  3 = 7  <span style="color:orange">\\\\\\\</span>
  3 = 7  {{color|orange|\\\\\\\}}
  4 = 15  <span style="color:orange">\\\\\\\\\\\\\\\</span>
  4 = 15  {{color|orange|\\\\\\\\\\\\\\\}}
  5 = 31  <span style="color:orange">\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\</span>
  5 = 31  {{color|orange|\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\}}
如果您仍感到疑惑,可看下方的拆解:
如果您仍感到疑惑,可看下方的拆解:


  bind <span style="color:green">[按键]</span> <span style="color:red">
  bind {{color|green|[按键]}}
  "</span>bind <span style="color:green">[按键]</span> <span style="color:orange">
  {{color|red|"}}bind {{color|green|[按键]}}
  \</span><span style="color:red">"</span><span style="color:blue">[设置/指令]</span> <span style="color:purple">[参数]</span><span style="color:red">;</span> bind <span style="color:green">[按键]</span><span style="color:orange">
  {{color|orange|\}}{{color|red|"}}{{color|blue|[设置/指令]}} {{color|purple|[参数]}}{{color|red|;}} bind {{color|green|[按键]}}
    \\\</span><span style="color:red">"</span><span style="color:blue">[设置/指令]</span> <span style="color:purple">[参数]</span><span style="color:red">;</span> bind <span style="color:green">[按键]</span> <span style="color:orange">
    {{color|orange|\\\}}{{color|red|"}}{{color|blue|[设置/指令]}} {{color|purple|[参数]}}{{color|red|;}} bind {{color|green|[按键]}}
    \\\\\\\</span><span style="color:red">"</span><span style="color:blue">[设置/指令]</span> <span style="color:purple">[参数]</span><span style="color:orange">
    {{color|orange|\\\\\\\}}{{color|red|"}}{{color|blue|[设置/指令]}} {{color|purple|[参数]}}
    \\\\\\\</span><span style="color:red">"</span><span style="color:orange">
    {{color|orange|\\\\\\\}}{{color|red|"}}
    \\\</span><span style="color:red">"</span><span style="color:orange">
    {{color|orange|\\\}}{{color|red|"}}
  \</span><span style="color:red">"
  {{color|orange|\}}{{color|red|"}}
   "</span>
   {{color|red|"}}


===有用的设置与指令===
===有用的设置与指令===


====切換====
====切換====
切換(英语:Toggles)可以令您在单个按键切換设置的两个参数。客户端中有两种切換方式:
切換(英语:Toggles)指令可以让您在单个按键切換设置的两个参数。客户端中有两种切換方式。


*'''toggle'''令您每按一次按键时切換为另一个参数。
*'''toggle''':令您每按一次按键时切換为另一个参数。
*'''+toggle'''令您在按下按键时使用第一个参数,松开按键时则使用第二个参数。
*'''+toggle''':令您在按下按键时使用第一个参数,松开按键时则使用第二个参数。


  bind <span style="color:green">[按键]</span> <span style="color:red">"</span><span style="color:magenta">toggle</span> <span style="color:blue">[设置]</span> <span style="color:purple">[参数1] [参数2]<span style="color:red">"</span></span>
  bind {{color|green|[按键]}} {{color|red|"}}{{color|magenta|toggle}} {{color|blue|[设置]}} {{color|purple|[参数1] [参数2]}}{{color|red|"}}


  bind <span style="color:green">[按键]</span> <span style="color:red">"</span><span style="color:magenta">+toggle</span> <span style="color:blue">[设置]</span> <span style="color:purple">[参数1] [参数2]<span style="color:red">"</span></span>
  bind {{color|green|[按键]}} {{color|red|"}}{{color|magenta|+toggle}} {{color|blue|[设置]}} {{color|purple|[参数1] [参数2]}}{{color|red|"}}


====说话====
====说话====
说话(英语: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.
说话(英语:Say)指令可以帮您在聊天框里快速输入文本。
  bind <span style="color:green">[key]</span> <span style="color:magenta">say</span> <span style="color:blue">/[chat command]</span>
  bind {{color|green|[按键]}} {{color|magenta|say}} {{color|blue|/[聊天框指令]}}


  bind <span style="color:green">[key]</span> <span style="color:magenta">say</span> <span style="color:blue">[chat message]</span>
  bind {{color|green|[按键]}} {{color|magenta|say}} {{color|blue|[聊天信息]}}


====颜色====
====颜色====
Some client commands allow you to set colors.
某些客户端指令可以让您设置颜色,例如:
*'''player_color_body'''
*'''player_color_body'''
*'''player_color_feet'''
*'''player_color_feet'''
*'''cl_message_client_color'''
*'''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.
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.
Line 77: Line 75:


====表情====
====表情====
The '''emote''' command can be used to display emotes without using the emote wheel.  Each emote is represented by a different number.
表情(英语:emote)指令可以让您在不使用表情选择器下快速发出表情。
[[File:Emotes.png|right|frameless]]
[[File:Emotes.png|right|frameless]]
{| class="wikitable"
{| class="wikitable"
Line 151: Line 149:
  <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>
  <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 <span style="color:green">[key]</span> <span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span>
  bind {{color|green|[按键]}} <span style="color:blue">[command/setting]</span> <span style="color:purple">[value]</span>
  bind <span style="color:green">[key]</span> <span style="color:magenta">exec</span> <span style="color:blue">[file.cfg]</span>
  bind {{color|green|[按键]}} <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.
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.


Line 171: Line 169:
  ~/.teeworlds  
  ~/.teeworlds  
Once the files are in the correct path, you can execute them in the game console with the '''exec''' command.
Once the files are in the correct path, you can execute them in the game console with the '''exec''' command.
  bind <span style="color:green">[key]</span> <span style="color:magenta">exec</span> <span style="color:blue">[file.cfg]</span>
  bind {{color|green|[按键]}} <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.
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>
  bind {{color|green|[按键]}} <span style="color:magenta">exec</span> <span style="color:blue">[path/to/file.cfg]</span>


===Improved toggle with config files===
===Improved toggle with config files===
Line 183: Line 181:
  <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 <span style="color:green">[key]</span> <span style="color:magenta">exec</span> <span style="color:blue">file2.cfg</span>
  bind {{color|green|[按键]}} <span style="color:magenta">exec</span> <span style="color:blue">file2.cfg</span>
'''file2.cfg'''
'''file2.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>
Line 189: Line 187:
  <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 <span style="color:green">[key]</span> <span style="color:magenta">exec</span> <span style="color:blue">file1.cfg</span>
  bind {{color|green|[按键]}} <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.
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 <span style="color:green">[key]</span> <span style="color:magenta">exec</span> <span style="color:blue">file1.cfg</span>
  bind {{color|green|[按键]}} <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.
You can use this method to cycle between any amount of files.


Line 249: Line 247:


'''cl_show_hook_coll_other'''
'''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>
  bind <span style="color:green">x</span> {{color|red|"}}<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>{{color|red|"}}


=== Deep Fly===
=== Deep Fly===
Line 260: Line 258:
====Using 2 Config Files====
====Using 2 Config Files====
'''deepfly_on.cfg'''
'''deepfly_on.cfg'''
  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>
  bind <span style="color:green">mouse1</span> {{color|red|"}}<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{{color|red|"}}
   
   
  <span style="color:blue">cl_message_client_color</span> <span style="color:purple">green</span>
  <span style="color:blue">cl_message_client_color</span> <span style="color:purple">green</span>
Line 280: Line 278:
You can accomplish the same thing as above using only 1 config file.
You can accomplish the same thing as above using only 1 config file.


  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 <span style="color:green">x</span> {{color|red|"}}bind <span style="color:green">mouse1</span> <span style="color:orange">\</span>{{color|red|"}}<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>{{color|red|"}}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>
Put this file in the correct path, and in console:
Put this file in the correct path, and in console:
  bind <span style="color:green">x</span> <span style="color:magenta">exec</span> <span style="color:blue">deepfly.cfg</span>
  bind <span style="color:green">x</span> <span style="color:magenta">exec</span> <span style="color:blue">deepfly.cfg</span>
Line 298: Line 296:


To manage dealing with both of these settings, you can either create a [https://wiki.ddnet.tw/wiki/Binds#Toggles toggle], use [https://wiki.ddnet.tw/wiki/Binds#Using_Config_Files config files], or have this setting attached to your weapon binds.
To manage dealing with both of these settings, you can either create a [https://wiki.ddnet.tw/wiki/Binds#Toggles toggle], use [https://wiki.ddnet.tw/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>
  bind {{color|green|[按键]}} <span style="color:blue">{{color|red|"}}+weapon1<span style="color:red">;</span></span> <span style="color:blue">cl_dummy_restore_weapon</span> <span style="color:red">0"</span>


  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>
  bind {{color|green|[按键]}} <span style="color:blue">{{color|red|"}}+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'''.
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===
===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.
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 <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>
  bind <span style="color:green">x</span> {{color|red|"}}<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">{{color|red|"}}
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.
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 <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>
  bind <span style="color:green">x</span> {{color|red|"}}<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">{{color|red|"}}
'''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.
'''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===
===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.
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>
  bind <span style="color:green">a</span> <span style="color:blue">{{color|red|"}}+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 colors to cycle through.
You can do this for several common inputs and get a variety of colors to cycle through.


'''rainbow_tee.cfg'''
'''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">a</span> <span style="color:blue">{{color|red|"}}+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">d</span> <span style="color:blue">{{color|red|"}}+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">space</span> <span style="color:blue">{{color|red|"}}+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">mouse1</span> <span style="color:blue">{{color|red|"}}+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>
  bind <span style="color:green">mouse2</span> <span style="color:blue">{{color|red|"}}+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.
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>
  <span style="color:magenta">exec</span> <span style="color:blue">rainbow_tee.cfg</span>
Line 326: Line 324:


'''rainbow_tee_on.cfg'''
'''rainbow_tee_on.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">a</span> <span style="color:blue">{{color|red|"}}+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">d</span> <span style="color:blue">{{color|red|"}}+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">space</span> <span style="color:blue">{{color|red|"}}+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">mouse1</span> <span style="color:blue">{{color|red|"}}+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>
  bind <span style="color:green">mouse2</span> <span style="color:blue">{{color|red|"}}+hook<span style="color:red">;</span> player_color_body</span> <span style="color:red">cyan"</span>
   
   
  <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>
  <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>

Revision as of 12:45, 3 September 2022

EnglishEspañolPortuguês (Brasil)УкраїнськаРусский简体中文DeutschItalianoFrançaisCatalàTürkçe한국어

在《DDNet》里你能通过F1控制台将设置与指令绑定到您的键盘和鼠标上。

语法

单指令绑定

bind [按键] [设置/指令] [参数]

此为绑定的基本语法。

  • [按键]:键盘和鼠标上您所选的任意按键。
  • [设置/指令]:您可以在官方网站(客户端设置客户端指令)或站内页面(客户端设置客户端指令)查找相关设置和指令。
  • [参数]:您想要调整的设置或指令的变量或参数。(仅有某些设置需要使用参数,指令和某些设置无需参数)

倘若您不知道某个按键的名称,可以在这个页面中查找,亦或者在游戏设置 > 控制中随意找一格按下你想要的按键,即会显示按键名称。您也可以与修饰键ctrl⇧ Shiftalt一起使用,如下:

bind ctrl+[按键] [设置/指令] [参数]

多指令绑定

您可以使用分号将多条设置与指令绑定到单一按键上:

bind [按键] "[设置/指令] [参数];[设置/指令] [参数]"

当您按下此按键后,所有绑定到这个按键的设置与指令会在同一时间被激活,换而言之,这些设置与指令不会按照您所写的顺序依次激活。如果您想它们依次激活,您可以将它们分别绑定到不同的按键上,依次按下以激活,或者使用配置文件让您多次按下同一按键时激活不同的设置与指令。

嵌套绑定

您可以使用反斜杠将一条绑定嵌套在另一绑定中:

bind [按键] "bind [按键] \"[设置/指令] [参数]; bind [按键] \\\"[设置/指令] [参数] \\\"\""

客户端的字符长度限制为255,而每一层嵌套的反斜杠数量为上一层的反斜杠数量乘二加一。倘若您使用六层嵌套,反斜杠数量将会是240个(1*2 + 3*2 + 7*2 + 15*2 + 31*2 + 63*2),这样您只剩15个字符可键入,因此只能接受最多五层嵌套。每一层的反斜杠数量如下:

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

如果您仍感到疑惑,可看下方的拆解:

bind [按键] 
 "bind [按键] 
  \"[设置/指令] [参数]; bind [按键] 
   \\\"[设置/指令] [参数]; bind [按键] 
    \\\\\\\"[设置/指令] [参数]
    \\\\\\\"
   \\\"
  \"
 "

有用的设置与指令

切換

切換(英语:Toggles)指令可以让您在单个按键切換设置的两个参数。客户端中有两种切換方式。

  • toggle:令您每按一次按键时切換为另一个参数。
  • +toggle:令您在按下按键时使用第一个参数,松开按键时则使用第二个参数。
bind [按键] "toggle [设置] [参数1] [参数2]"
bind [按键] "+toggle [设置] [参数1] [参数2]"

说话

说话(英语:Say)指令可以帮您在聊天框里快速输入文本。

bind [按键] say /[聊天框指令]
bind [按键] say [聊天信息]

颜色

某些客户端指令可以让您设置颜色,例如:

  • player_color_body
  • player_color_feet
  • cl_message_client_color

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.

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.

表情

表情(英语:emote)指令可以让您在不使用表情选择器下快速发出表情。

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

其它

dump_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 [按键] [command/setting] [value]
bind [按键] 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%\Teeworlds

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/Teeworlds

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.

Linux
~/.teeworlds 

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

bind [按键] 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 [按键] 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 [按键] exec file2.cfg

file2.cfg

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

bind [按键] 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 [按键] 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.

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 [按键] "+weapon1; cl_dummy_restore_weapon 0"
bind [按键] "+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 colors 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.

另见