Binds/zh: Difference between revisions

From DDraceNetwork
(Created page with "您需要将配置文件放在配置目录中,有关于配置目录的路径,详见:《DDNet》的配置文件,配置目录在哪?")
(Created page with "====注释====")
Line 316: Line 316:
====武器切换====
====武器切换====


<div lang="en" dir="ltr" class="mw-content-ltr">
{{color|blue|cl_dummy_restore_weapon}} {{color|purple|1}}
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>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">

Revision as of 09:59, 14 February 2023

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

语法

单指令绑定

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

此为绑定的基本语法。

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

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

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

以上为部分例子。

想知道您所要的颜色参数,您可先在设定内调好,再在F1控制台内查询。例如在 设置 > Tee 里将本体身体颜色调成绿色后,可以在控制台内使用与其所对应的客户端指令player_color_body ,所返回在Value:后的一串数字则是您所调的绿色的参数。

然后您可使用以下绑定快速设置颜色:
bind [按键] player_color_body 5635840

或者使用十六进制代码:

bind [按键] player_color_body $00FF00

客户端也支持直接使用某些颜色名:redyellowgreencyanbluemagentawhitegray black

表情

表情(英语: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 谩骂Tee splattee
emote 10 魔鬼Tee deviltee
emote 11 粗鄙之语 zomg
emote 12 打哈欠 zzz
emote 13 什么鬼 wtf
emote 14 笑脸 eyes
emote 15 疑问 question

假如您想发出鬼魂表情时,您要输入:

bind [按键] emote 14

其它

如果您想知道某个按键的绑定,输入:
binds [按键]

当您不输入按键时,则会显示所有按键的绑定。

如果您想取消某个按键的绑定,输入:

unbind [按键]

使用配置文件

语法

对于更复杂的绑定,您可以创建并使用配置文件。

settings.cfg

[设置/指令] [参数]
[设置/指令] [参数]
[设置/指令] [参数]; [设置/指令] [参数]
[设置/指令] [参数]; [设置/指令] [参数]

bind [按键] [设置/指令] [参数]
bind [按键] exec [文件名.cfg]

如上,在配置文件里,多条设置/指令可以以分号或分行分隔开。您可将您所要的设置/指令/绑定都写在单个配置文件里,然后将其绑定在按键上:

bind [按键] [settings.cfg]

备注:后缀名.cfg可以更改为任何您想要的后缀名。

路径与执行

您需要将配置文件放在配置目录中,有关于配置目录的路径,详见:《DDNet》的配置文件,配置目录在哪?

当您将配置文件放在正确的路径,您可以在F1控制台使用exec指令执行它:

bind [按键] exec [配置文件.cfg]

当您将配置文件放在配置目录下的文件夹中,您需把文件夹的名也给打上:

bind [按键] exec [文件夹/to/配置文件.cfg]

进阶切换

配置文件可以让您更容易的切换,您只需要创建两个配置文件:

配置文件1.cfg

[设置/指令] [参数]
[设置/指令] [参数]
[设置/指令] [参数]

bind [按键] exec 配置文件2.cfg

配置文件2.cfg

[设置/指令] [参数]
[设置/指令] [参数]
[设置/指令] [参数]

bind [按键] exec 配置文件1.cfg

在两个配置文件里的[按键]需为同一按键。将其中一个配置文件绑定到[按键]中:

bind [按键] exec 配置文件1.cfg

这样您每按一次按键,都会执行相对配置文件的设置/指令并将按键绑定为另一个配置文件,以此达到循环切换。您还可以在此循环内加入更多的配置文件。

自定义

回应

回应(英语:echo)指令可以让您更清楚的了解您执行了什么设置/指令。

[设置/指令] [参数]
[设置/指令] [参数]

echo 设置开

bind [按键] exec 配置文件1.cfg

这样当您按下[按键]时,聊天框会显示“设置开”。

您更可以加上颜色:

[设置/指令] [参数]
[设置/指令] [参数]

cl_message_client_color red
echo 设置关

bind [按键] exec 配置文件1.cfg

这样当您按下[按键]时,聊天框会显示“设置关”。将开关定为不同的颜色,可方便您了解您执行了什么设置/指令。

注释

在配置文件里,您可使用注释:

 # 以下为设置/指令
[设置/指令] [参数]
[设置/指令] [参数]

# 以下为将按键绑定为另一配置文件 
bind [按键] exec 配置文件1.cfg

绑定例子

辅助线常开

cl_show_hook_coll_own指令能让您在不用+showhookcoll绑定(默认为S键)下显示辅助线。当您将其参数设为2时,您的辅助线会对您常显示(其他玩家不会看见)。

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

将这两个配置文件放在配置目录里,并在F1控制台输入:

bind x exec hook_line_on.cfg

显示所有玩家辅助线

cl_show_hook_coll_other指令能让您看到所有玩家的辅助线。您可以直接将其添加到默认绑定中:

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

深度冻结飞行

深度冻结飞行(英语:Deep Fly)绑定可以让您的分身朝您锤击/开火。如果您的分身处于深度冻结状态,您使用此绑定锤击它时,它们也会锤击您。以此,在练习后您可与在深度冻结状态下的分身飞行(某些地图会设置成深度冻结状态下不能锤击/开火)。而如果没有被深度冻结,您也可以以此绑定取代默认的Hammerfly绑定,这能让您更好的控制分身锤击时间。

cl_dummy_hammer 1是一般在设置里的分身Hammerfly绑定。使用切换就能达到在按下按键时,分身才锤击的效果,如下:

使用两个配置文件

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

将这两个配置文件放在配置目录里,并在F1控制台输入:

bind x exec deepfly_on.cfg

使用单个配置文件

您也可以将以上两个配置文件整合:

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

将这个配置文件放在配置目录里,并在F1控制台输入:

bind x exec deepfly.cfg

备注一:配置文件中假定了您的+fire(开火)绑定在mouse1 (鼠标左键)上。

备注二:如果您使用单个配置文件,在您按住开火键时关闭绑定的话,会出现所谓卡键的情况,因为您的cl_dummy_hammer指令参数固定为1。您只能通过使用两个配置文件解决。

武器切换

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

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