Binds/ru: Difference between revisions

From DDraceNetwork
(Created page with "===Улучшение переключения с файлами конфигурации===")
Tags: mobile web edit mobile edit
(Created page with "несколько примеров.")
Line 198: Line 198:
Наиболее распространенной причиной использования конфигурационных файлов является создание переключения между двумя файлами с помощью одной клавиши.
Наиболее распространенной причиной использования конфигурационных файлов является создание переключения между двумя файлами с помощью одной клавиши.


<div lang="en" dir="ltr" class="mw-content-ltr">
'''file1.cfg'''
'''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>
Line 211: Line 210:
   
   
  bind <span style="color:green">[key]</span> <span style="color:magenta">exec</span> <span style="color:blue">file1.cfg</span>
  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 filesThis 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.
В этом случае '''[key]''' будет одной и той же клавишей в обоих файлахТаким образом, при каждом нажатии клавиши будет происходить переключение на другой файл. После того, как оба файла находятся в правильном пути, вы можете выполнить любой из них всего один раз, и они будут привязаны навсегда, пока вы их не снимете.
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">
<span id="Customization"></span>
===Customization===
===Кастомизация===
</div>


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

Revision as of 15:58, 14 June 2023

Клиент DDNet имеет множество команд и настроек, которые можно забиндить практически на любую клавишу или кнопку мыши. Вы можете вводить команды в консоль, которая по умолчанию вызывается нажатием клавиши F1.

Синтаксис

Одиночное бинды

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

Это основной синтаксис для простых биндов.

  • [key] - это клавиша на клавиатуре/мыши, к которой вы хотите привязать команду.
  • [command/setting] Полный список всех команд и настроек можно найти здесь.
  • [value] - переменная, на которую вы хотите установить настройку или аргумент для команды. Не все команды требуют аргументов.

Вы можете найти коды ключей здесь, или просто временно введите ключ в один из элементов управления на странице Settings > Controls в клиенте DDNet, и он покажет имя ключа. Вы также можете использовать клавиши-модификаторы с биндами.

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

вы можете использовать ctrl, alt, shift и gui. Gui используется для обозначения клавиши windows в windows, command в macOS/osx и super/meta в linux.

Многократные бинды

Вы также можете объединить команды/настройки в цепочку, разделив их точкой с запятой и заключив в кавычки. Вы можете добавить в эту цепочку столько команд, сколько захотите.

 bind [key] "[command/setting] [value]; [command/setting] [value]"

Важно знать, что при бинде вещей подобным образом все команды / настройки выполняются игрой в одно и то же время, что означает, что они не будут выполняться последовательно в том порядке, в котором вы их записываете. Нет команды типа sleep или delay для размещения объектов так, как вы хотите. Лучший способ заставить события происходить в упорядоченной последовательности - это либо забиндить другой [key] для каждого шага последовательности, либо использовать конфигурационные файлы для многократного нажатия одной клавиши для последовательного чтения нескольких файлов.

Вложенные биндов

Вы можете поместить несколько строк, заключенных в кавычки, в одну строку, экранируя каждый новый набор кавычек обратной косой чертой.

bind [key] "bind [key] \"[command/setting] [value]; bind [key] \\\"[command/setting] [value] \\\"\""

Поскольку заключенные в кавычки строки становятся глубже, вам также необходимо избегать обратной косой черты. Поскольку каждый новый слой снова будет удалять их, вам нужно удвоить количество обратных косых черт для каждого слоя. Максимальное количество слоев, которые вы можете использовать, равно "'5"', прежде чем консоль выдаст вам сообщение об ошибке. Это связано с тем, что консоль имеет максимальное ограничение на количество символов "'255"'. Количество обратных косых черт для 6 слоев равно "'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 [key] 
 "bind [key] 
  \"[command/setting] [value]; bind [key]
   \\\"[command/setting] [value]; bind [key] 
    \\\\\\\"[command/setting] [value]
    \\\\\\\"
   \\\"
  \"
 "

Примечание: Вы не можете запустить файл конфигурации, отформатированный так, как показано в примере выше, он не будет работать. Этот пример приведен только для того, чтобы получить четкое визуальное представление о том, как строится вложенный бинд.

Полезные команды и настройки

Переключатели

Переключатели - это способ использования одной клавиши для чередования двух значений параметра. Существует два типа переключателей.

  • toggle используется для того, чтобы при каждом нажатии клавиши переключаться между одним из двух значений настройки
  • +toggle используется для того, чтобы первое значение устанавливалось только во время нажатия клавиши, а второе значение устанавливалось, когда клавиша отпускается.
bind [key] toggle [setting] [value1] [value2]
bind [key] +toggle [setting] [value1] [value2]

Переключатели работают только для настроек клиента. Их нельзя использовать для команд клиента или чата.

Say

Say - важная клиентская команда для привязки. Это позволяет вам включать команды чата в привязку, а также просто отправлять текст в чат.

bind [key] say /[chat command]
bind [key] say [chat message]

Цвета

Некоторые команды клиента позволяют задавать цвета.

  • player_color_body
  • player_color_feet
  • cl_message_client_color

несколько примеров.

Чтобы получить правильные значения цвета, перейдите в Настройки > Tee и с помощью ползунков найдите нужный вам цвет. Зайдите в консоль и введите команду для цвета, который вы пытаетесь установить, без значения. Число, которое идет после "Value:", является соответствующим числом.

Пример значения цвета

player_color_body 5635840

или, если вы предпочитаете использовать шестнадцатеричное значение:

player_color_body $00FF00

Он также принимает несколько значений цвета по имени. red, yellow, green, cyan, blue, magenta, white, gray, 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 splattee
emote 10 deviltee
emote 11 zomg
emote 12 zzz
emote 13 wtf
emote 14 eyes
emote 15 question

Например:

bind h emote 14

Другое

binds [key]

Вы можете использовать эту команду для печати того, что привязано к одной клавише. Используйте ее без ключа в конце, чтобы получить полный список всех текущих привязок.

unbind [key]

Отвязывает бинд, который вы указали.

Использование файлов конфигурации

Синтаксис

Для более сложных биндов можно создать текстовые файлы с настройками/командами, которые будут выполняться при нажатии клавиш.

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]

Настройки/команды могут быть соединены в цепочку через точку с запятой или просто с новой строки. Вы можете поместить в эти файлы столько команд/настроек/биндов, сколько захотите.

Примечание: Вам не обязательно использовать .cfg в качестве расширения. Вы можете использовать любое расширение файла. 'cfg просто кажется стандартным.

Path/Exec

Чтобы выполнить эти файлы, необходимо поместить их в правильный каталог и выполнить с помощью команды exec. Правильный путь зависит от вашей операционной системы. Чтобы найти правильный путь для вашей операционной системы, смотрите Где находится DDNet config, config directory или save directory?.

Когда файлы находятся в правильном пути, вы можете выполнить их в игровой консоли с помощью команды exec.

exec [file.cfg]

или bind [key] exec [file.cfg] Для организации файлов можно использовать подкаталоги в каталоге 'DDNet' или 'Teeworlds'. Просто укажите путь при выполнении файла.

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

Улучшение переключения с файлами конфигурации

Наиболее распространенной причиной использования конфигурационных файлов является создание переключения между двумя файлами с помощью одной клавиши.

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

В этом случае [key] будет одной и той же клавишей в обоих файлах. Таким образом, при каждом нажатии клавиши будет происходить переключение на другой файл. После того, как оба файла находятся в правильном пути, вы можете выполнить любой из них всего один раз, и они будут привязаны навсегда, пока вы их не снимете.

Кастомизация

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.


Note: If the mapper has set sv_deepfly 0 on their map, you will not be able to deep fly with a deep frozen tee, since it can sometimes enable players to do parts in ways that the mapper did not intend. The deep fly bind will still work normally with frozen or unfrozen tees. As a player, this is not a setting you can adjust.

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, and by nature of how this bind works, your crosshair won't show direction either.

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