User:By/draft: Difference between revisions

From DDraceNetwork
By (talk | contribs)
Translate
By (talk | contribs)
clear
Tag: Blanking
 
Line 1: Line 1:
{{LangNavBox}}
在《DDNet》里你能通过F1控制台将[[Settings and Commands/zh|设置与指令]]'''绑定'''到您的键盘和鼠标上。


==语法==
===单指令绑定===
bind {{color|green|[按键]}} {{color|blue|[设置/指令]}} {{color|purple|[参数]}}
此为绑定的基本语法。
*'''[按键]''':键盘和鼠标上您所选的任意按键。
*'''[设置/指令]''':您可以在官方网站([https://ddnet.tw/settingscommands/#client-settings 客户端设置]/[https://ddnet.tw/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}}一起使用,如下:
bind {{color|magenta|ctrl+}}{{color|green|[按键]}} {{color|blue|[设置/指令]}} {{color|purple|[参数]}}
===多指令绑定===
您可以使用分号将多条设置与指令绑定到单一按键上:
bind {{color|green|[按键]}} {{color|red|"}}{{color|blue|[设置/指令]}} {{color|purple|[参数]}}{{color|red|;}}{{color|blue|[设置/指令]}} {{color|purple|[参数]}}{{color|red|"}}
当您按下此按键后,所有绑定到这个按键的设置与指令会在同一时间被激活,换而言之,这些设置与指令不会按照您所写的顺序依次激活。如果您想它们依次激活,您可以将它们分别绑定到不同的按键上,依次按下以激活,或者[[#使用配置文件|使用配置文件]]让您多次按下同一按键时激活不同的设置与指令。
===嵌套绑定===
您可以使用反斜杠将一条绑定嵌套在另一绑定中:
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|"}}
===实用设置与指令===
====切換====
切換(英语:Toggles)指令可以让您在单个按键切換设置的两个参数。客户端中有两种切換方式。
*'''toggle''':令您每按一次按键时切換为另一个参数。
*'''+toggle''':令您在按下按键时使用第一个参数,松开按键时则使用第二个参数。
bind {{color|green|[按键]}} {{color|red|"}}{{color|magenta|toggle}} {{color|blue|[设置]}} {{color|purple|[参数1] [参数2]}}{{color|red|"}}
bind {{color|green|[按键]}} {{color|red|"}}{{color|magenta|+toggle}} {{color|blue|[设置]}} {{color|purple|[参数1] [参数2]}}{{color|red|"}}
====说话====
说话(英语:Say)指令可以帮您在聊天框里快速输入文本。
bind {{color|green|[按键]}} {{color|magenta|say}} {{color|blue|/[聊天框指令]}}
bind {{color|green|[按键]}} {{color|magenta|say}} {{color|blue|[聊天信息]}}
====颜色====
某些客户端指令可以让您设置颜色,例如:
*'''player_color_body'''
*'''player_color_feet'''
*'''cl_message_client_color'''
想知道您所要的颜色参数,您可先在设定内调好,再在F1控制台内查询。例如在 设置> Tee 里将本体身体颜色调成绿色后,可以在控制台内使用与其所对应的客户端指令<code>player_color_body
</code>,所返回在'''Value:'''后的一串数字则是您所调的绿色的参数。
[[File:Colors.png]]
然后您可使用以下绑定快速设置颜色:
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'''。
====表情====
表情(英语:emote)指令可以让您在不使用表情选择器下快速发出表情。
[[File:Emotes.png|right|frameless]]
{| class="wikitable"
|-
! 指令与参数 !! 表情解释 !! 英语原文
|-
|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|| 魔鬼Tee || deviltee
|-
|emote 11||  || zomg
|-
|emote 12||  || zzz
|-
|emote 13||  ||wtf
|-
|emote 14|| 眼睛 || eyes
|-
|emote 15|| 疑问 ||question
|}
假如您想发出鬼魂表情时,您要输入:
bind {{color|green|[按键]}} {{color|blue|emote}} {{color|purple|14}}
====其它====
如果您想知道某个按键的绑定,输入:
dump_binds {{color|green|[按键]}}
当您不输入按键时,则会显示所有按键的绑定。
如果您想取消某个按键的绑定,输入:
unbind {{color|green|[按键]}}
==使用配置文件==
===语法===
对于更复杂的绑定,您可以创建并使用配置文件。
'''settings.cfg'''
{{color|blue|[设置/指令]}} {{color|purple|[参数]}}
{{color|blue|[设置/指令]}} {{color|purple|[参数]}}
{{color|blue|[设置/指令]}} {{color|purple|[参数]}}{{color|red|;}} {{color|blue|[设置/指令]}} {{color|purple|[参数]}}
{{color|blue|[设置/指令]}} {{color|purple|[参数]}}{{color|red|;}} {{color|blue|[设置/指令]}} {{color|purple|[参数]}}
bind {{color|green|[按键]}} {{color|blue|[设置/指令]}} {{color|purple|[参数]}}
bind {{color|green|[按键]}} {{color|magenta|exec}} {{color|blue|[文件名.cfg]}}
如上,在配置文件里,多条设置/指令可以以分号或分行分隔开。您可将您所要的设置/指令/绑定都写在单个配置文件里,然后将其绑定在按键上:
bind {{color|green|[按键]}} {{color|blue|[settings.cfg]}}
'''备注''':后缀名'''.cfg'''可以更改为任何您想要的后缀名。
===路径与执行===
您需要将配置文件放在配置目录中,有关于配置目录的路径,详见:[[FAQ/zh#《DDNet》的配置文件,配置目录在哪?|《DDNet》的配置文件,配置目录在哪?]]
当您将配置文件放在正确的路径,您可以在F1控制台使用<code>exec</code>指令执行它:
bind {{color|green|[按键]}} {{color|magenta|exec}} {{color|blue|[配置文件.cfg]}}
当您将配置文件放在配置目录下的文件夹中,您需把文件夹的名也给打上:
bind {{color|green|[按键]}} {{color|magenta|exec}} {{color|blue|[文件夹/to/配置文件.cfg]}}
===进阶切換===
配置文件可以让您更容易的切換,您只需要创建两个配置文件:
'''配置文件1.cfg'''
{{color|blue|[设置/指令]}} {{color|purple|[参数]}}
{{color|blue|[设置/指令]}} {{color|purple|[参数]}}
{{color|blue|[设置/指令]}} {{color|purple|[参数]}}
bind {{color|green|[按键]}} {{color|magenta|exec}} {{color|blue|配置文件2.cfg}}
'''配置文件2.cfg'''
{{color|blue|[设置/指令]}} {{color|purple|[参数]}}
{{color|blue|[设置/指令]}} {{color|purple|[参数]}}
{{color|blue|[设置/指令]}} {{color|purple|[参数]}}
bind {{color|green|[按键]}} {{color|magenta|exec}} {{color|blue|配置文件1.cfg}}
在两个配置文件里的[按键]需为同一按键。将其中一个配置文件绑定到[按键]中:
bind {{color|green|[按键]}} {{color|magenta|exec}} {{color|blue|配置文件1.cfg}}
这样您每按一次按键,都会执行相对配置文件的设置/指令并将按键绑定为另一个配置文件,以此达到循环切換。您还可以在此循环内加入更多的配置文件。
===自定义===
====回应====
回应(英语:echo)指令可以让您更清楚的了解您执行了什么设置/指令。
[设置/指令] [参数]
[设置/指令] [参数]
{{color|blue|echo}} {{color|purple|设置开}}
bind [按键] exec 配置文件1.cfg
这样当您按下[按键]时,聊天框会显示“设置开”。
您更可以加上颜色:
[设置/指令] [参数]
[设置/指令] [参数]
{{color|blue|cl_message_client_color}} {{color|purple|red}}
{{color|blue|echo}} {{color|purple|设置关}}
bind [按键] exec 配置文件1.cfg
这样当您按下[按键]时,聊天框会显示“{{color|red|设置关}}”。
将开关定为不同的颜色,可方便您了解您执行了什么设置/指令。
====注释====
在配置文件里,您可使用注释:
{{color|purple|# 以下为设置/指令}}
[设置/指令] [参数]
[设置/指令] [参数]
{{color|purple|# 以下为将按键绑定为另一配置文件}}
bind [按键] exec 配置文件1.cfg
==实用绑定==
===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'''
{{color|blue|cl_show_hook_coll_own}} {{color|purple|2}}
{{color|blue|cl_message_client_color}} {{color|purple|green}}
{{color|blue|echo}} {{color|purple|Hook Line ON}}
bind {{color|green|x}} {{color|magenta|exec}} {{color|blue|hook_line_off.cfg}}
'''hook_line_off.cfg'''
{{color|blue|cl_show_hook_coll_own}} {{color|purple|1}}
{{color|blue|cl_message_client_color}} {{color|purple|red}}
{{color|blue|echo}} {{color|purple|Hook Line OFF}}
bind {{color|green|x}} {{color|magenta|exec}} {{color|blue|hook_line_on.cfg}}
Put both of these in the correct path, and in console:
bind {{color|green|x}} {{color|magenta|exec}} {{color|blue|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 {{color|green|x}} {{color|red|"}}<span style="color:blue">+showhookcoll</span>{{color|red|;}} <span style="color:magenta">+toggle</span> <span style="color:blue">cl_show_hook_coll_other</span> {{color|purple|2 1}}{{color|red|"}}
=== 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.
[[File:Deepfly webm.webm|351x198px|gif]]
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.tw/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.
====Using 2 Config Files====
'''deepfly_on.cfg'''
bind <span style="color:green">mouse1</span> {{color|red|"}}<span style="color:blue">+fire</span>{{color|red|;}} <span style="color:magenta">+toggle</span> <span style="color:blue">cl_dummy_hammer</span> {{color|purple|1 0}}{{color|red|"}}
<span style="color:blue">cl_message_client_color</span> {{color|purple|green}}
{{color|blue|echo}} {{color|purple|Deep Fly ON}}
bind {{color|green|x}} {{color|magenta|exec}} <span style="color:blue">deepfly_off.cfg</span>
'''deepfly_off.cfg'''
bind <span style="color:green">mouse1</span> <span style="color:blue">+fire</span>
<span style="color:blue">cl_dummy_hammer</span> {{color|purple|0}}
<span style="color:blue">cl_message_client_color</span> {{color|purple|red}}
{{color|blue|echo}} {{color|purple|Deep Fly OFF}}
bind {{color|green|x}} {{color|magenta|exec}} <span style="color:blue">deepfly_on.cfg</span>
Put both of these in the correct path, and in console:
bind {{color|green|x}} {{color|magenta|exec}} <span style="color:blue">deepfly_on.cfg</span>
====Using 1 Config File ====
You can accomplish the same thing as above using only 1 config file.
bind {{color|green|x}} {{color|red|"}}bind <span style="color:green">mouse1</span> <span style="color:orange">\</span>{{color|red|"}}<span style="color:blue">+fire</span>{{color|red|;}} <span style="color:blue"><span style="color:magenta">+toggle</span> cl_dummy_hammer</span> {{color|purple|1 0}}<span style="color:orange">\</span><span style="color:red">";</span><span style="color:blue">cl_message_client_color</span> {{color|purple|green}}{{color|red|;}} {{color|blue|echo}} {{color|purple|Deep Fly ON}}{{color|red|;}} bind {{color|green|x}} <span style="color:orange">\</span>{{color|red|"}}bind <span style="color:green">mouse1</span> <span style="color:blue">+fire</span>{{color|red|;}} <span style="color:blue">cl_dummy_hammer</span> {{color|purple|0}}{{color|red|;}} <span style="color:blue">cl_message_client_color</span> {{color|purple|red}}{{color|red|;}} {{color|blue|echo}} {{color|purple|Deep Fly OFF}}{{color|red|;}} {{color|magenta|exec}} <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:
bind {{color|green|x}} {{color|magenta|exec}} <span style="color:blue">deepfly.cfg</span>
'''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:
<span style="color:blue">cl_dummy_restore_weapon</span> {{color|purple|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'''.
<span style="color:blue">cl_dummy_restore_weapon</span> {{color|purple|1}}
This will allow you to laser yourself with your dummy with perfect aim.  It can also be useful with shotgun.
[[File:Deepfly laser example.webm|351x198px|gif]]
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 {{color|green|[按键]}} <span style="color:blue">{{color|red|"}}+weapon1{{color|red|;}}</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|"}}+weapon5{{color|red|;}}</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'''.
===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 {{color|green|x}} {{color|red|"}}<span style="color:magenta">+toggle</span> <span style="color:blue">cl_mouse_max_distance</span> {{color|purple|2 400}}{{color|red|;}} <span style="color:magenta">+toggle</span> <span style="color:blue">inp_mousesens</span> {{color|purple|1 200}}{{color|red|;}} <span style="color:blue">+showhookcoll</span>{{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.
bind {{color|green|x}} {{color|red|"}}<span style="color:magenta">+toggle</span> <span style="color:blue">cl_mouse_max_distance</span> {{color|purple|2 [Your Value]}}{{color|red|;}} <span style="color:magenta">+toggle</span> <span style="color:blue">inp_mousesens</span> {{color|purple|1 [Your Value]}}{{color|red|;}} <span style="color:blue">+showhookcoll</span>{{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.
===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 <span style="color:green">a</span> <span style="color:blue">{{color|red|"}}+left{{color|red|;}} 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.
'''rainbow_tee.cfg'''
bind <span style="color:green">a</span> <span style="color:blue">{{color|red|"}}+left{{color|red|;}} player_color_body</span> <span style="color:red">red"</span>
bind <span style="color:green">d</span> <span style="color:blue">{{color|red|"}}+right{{color|red|;}} player_color_body</span> <span style="color:red">yellow"</span>
bind <span style="color:green">space</span> <span style="color:blue">{{color|red|"}}+jump{{color|red|;}} player_color_body</span> <span style="color:red">green"</span>
bind <span style="color:green">mouse1</span> <span style="color:blue">{{color|red|"}}+fire{{color|red|;}} player_color_body</span> <span style="color:red">blue"</span>
bind <span style="color:green">mouse2</span> <span style="color:blue">{{color|red|"}}+hook{{color|red|;}} 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.
{{color|magenta|exec}} <span style="color:blue">rainbow_tee.cfg</span>
Or if you want a key to toggle it on and off:
'''rainbow_tee_on.cfg'''
bind <span style="color:green">a</span> <span style="color:blue">{{color|red|"}}+left{{color|red|;}} player_color_body</span> <span style="color:red">red"</span>
bind <span style="color:green">d</span> <span style="color:blue">{{color|red|"}}+right{{color|red|;}} player_color_body</span> <span style="color:red">yellow"</span>
bind <span style="color:green">space</span> <span style="color:blue">{{color|red|"}}+jump{{color|red|;}} player_color_body</span> <span style="color:red">green"</span>
bind <span style="color:green">mouse1</span> <span style="color:blue">{{color|red|"}}+fire{{color|red|;}} player_color_body</span> <span style="color:red">blue"</span>
bind <span style="color:green">mouse2</span> <span style="color:blue">{{color|red|"}}+hook{{color|red|;}} player_color_body</span> <span style="color:red">cyan"</span>
{{color|purple|bind}} {{color|green|x}} {{color|magenta|exec}} <span style="color:blue">rainbow_tee_off.cfg</span>
'''rainbow_tee_off.cfg'''
bind <span style="color:green">a</span> <span style="color:blue">+left</span>
bind <span style="color:green">d</span> <span style="color:blue">+right</span>
bind <span style="color:green">space</span> <span style="color:blue">+jump</span>
bind <span style="color:green">mouse1</span> <span style="color:blue">+fire</span>
bind <span style="color:green">mouse2</span> <span style="color:blue">+hook</span>
{{color|purple|bind}} {{color|green|x}} {{color|magenta|exec}} <span style="color:blue">rainbow_tee_on.cfg</span>
Put both of these in the correct path, and in console:
bind {{color|green|x}} {{color|magenta|exec}} <span style="color:blue">rainbow_tee_on.cfg</span>
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.tw/wiki/Binds#Colors colors]
'''Note:''' This assumes you have default binds for left, right, jump, fire, and hook.
==另见==
*[https://forum.ddnet.tw/viewtopic.php?t=2537 Just bind it] - Useful binds available for copying
*[https://forum.ddnet.tw/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] - A video tutorial about binds by KlexMikrowelle

Latest revision as of 16:25, 3 September 2022