Binds/zh: Difference between revisions

From DDraceNetwork
(Created page with "'''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|[设置/指令]}} {{...")
Tags: mobile web edit mobile edit
(Created page with "配置文件可以让您更容易的切换,您只需要创建两个配置文件:")
Line 204: Line 204:
===自定义===
===自定义===


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Echo"></span>
====Echo====
====回应====
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
回应(英语: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]
   
   
  <span style="color:blue">echo</span> <span style="color:purple">setting ON</span>
  {{color|blue|echo}} {{color|purple|设置开}}
   
   
  bind [key] exec file1.cfg
  bind [按键] exec 配置文件1.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]
您更可以加上颜色:
  [设置/指令] [参数]
  [设置/指令] [参数]
   
   
  <span style="color:blue">cl_message_client_color</span> <span style="color:purple">red</span>
  {{color|blue|cl_message_client_color}} {{color|purple|red}}
  <span style="color:blue">echo</span> <span style="color:purple">setting OFF</span>
  {{color|blue|echo}} {{color|purple|设置关}}
   
   
  bind [key] exec file1.cfg
  bind [按键] exec 配置文件1.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 [https://wiki.ddnet.org/wiki/Binds#Colors colors].
这样当您按下[按键]时,聊天框会显示“{{color|red|设置关}}”。将开关定为不同的颜色,可方便您了解您执行了什么设置/指令。
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Comments"></span>
====Comments====
====注释====
</div>


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


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


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Examples"></span>
==Examples==
==绑定例子==
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Hook_line_always_on"></span>
===Hook line always on===
===辅助线常开===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<code>cl_show_hook_coll_own</code>指令能让您在不用<code>+showhookcoll</code>绑定(默认为{{key press|S}}键)下显示辅助线。当您将其参数设为<code>2</code>时,您的辅助线会对您常显示(其他玩家不会看见)。
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'''
  <span style="color:blue">cl_show_hook_coll_own</span> <span style="color:purple">2</span>
  {{color|blue|cl_show_hook_coll_own}} {{color|purple|2}}
   
   
  <span style="color:purple"><span style="color:blue">cl_message_client_color</span> <span style="color:purple">green</span>
  {{color|blue|cl_message_client_color}} {{color|purple|green}}
  <span style="color:blue">echo</span> <span style="color:purple">Hook Line ON</span>
  {{color|blue|echo}} {{color|purple|Hook Line ON}}
   
   
  bind <span style="color:green">x</span> <span style="color:magenta">exec</span> <span style="color:blue">hook_line_off.cfg</span>
  bind {{color|green|x}} {{color|magenta|exec}} {{color|blue|hook_line_off.cfg}}
'''hook_line_off.cfg'''
'''hook_line_off.cfg'''
  <span style="color:blue">cl_show_hook_coll_own</span> <span style="color:purple">1</span>
  {{color|blue|cl_show_hook_coll_own}} {{color|purple|1}}
   
   
  <span style="color:purple"><span style="color:blue">cl_message_client_color</span> <span style="color:purple">red</span>
  {{color|blue|cl_message_client_color}} {{color|purple|red}}
  <span style="color:blue">echo</span> <span style="color:purple">Hook Line OFF</span>
  {{color|blue|echo}} {{color|purple|Hook Line OFF}}
   
   
  bind <span style="color:green">x</span> <span style="color:magenta">exec</span> <span style="color:blue">hook_line_on.cfg</span>
  bind {{color|green|x}} {{color|magenta|exec}} {{color|blue|hook_line_on.cfg}}
Put both of these 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">hook_line_on.cfg</span>
  bind {{color|green|x}} {{color|magenta|exec}} {{color|blue|hook_line_on.cfg}}
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Everyone&#039;s_hooklines"></span>
===Everyone's hooklines===
===显示所有玩家辅助线===
</div>


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

Revision as of 09:57, 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

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