Vinculación de teclas (Binds)
El cliente DDnet tiene una multitud de comandos y configuraciones que pueden ser vinculados a casi cualquier tecla o botón del ratón. Puedes introducir estos comandos en la consola, que por predeterminado se abre con el botón F1.
Sintaxis
Binds simples
bind [key] [command/setting] [value]
Esta es la sintaxis básica para enlaces (Binds) simples (Deben ser escritos en inglés para funcionar correctamente)
- [key] Es la tecla o botón de tu teclado o ratón a la cual enlazarás con un comando.
- [command/setting] Encontrarás una lista entera de comandos y configuraciones Aquí.
- [value] Es la variable en la cual quieres establecer tus comandos o a un argumento (Informático) para un comando.
Podrás encontrar el nombre de las teclas Aqui, o solo escribe la tecla temporalmente en uno de los controles en la parte de Configuraciones > Controles en el cliente DDNet y te mostrará el nombre de la tecla. También puedes usar teclas modificadoras con los enlaces
bind ctrl+[key] [command/setting] [value]
Puedes usar ctrl, alt, shift, y gui. Gui es usado para referirse a la tecla de Windows en Windows, la tecla de comando en macOS/osx, y super/meta en linux.
Binds múltiples
También puedes escribir secuencias de comandos/configuraciones en cadena usando el punto y coma para separarlos y encerrándolos entre comillas. Puedes agregar tantos comandos como quieras a esta secuencia. bind [key] "[command/setting] [value]; [command/setting] [value]"
Es importante saber que cuando estés encadenando cosas de esta manera, todos los comandos/configuraciones se ejecutan por el juego exactamente al mismo tiempo, es decir, que no se ejecutan en el orden en el que los has escrito. No existe ningún comando para atrasar para separar las cosas como quieras. La mejor manera para separar u ordenar secuencias de comandos es o vincularlos a distintas teclas, o usando archivos de configuración para presionar una tecla múltiples veces para leer múltiples archivos.
Binds anidados
Puedes anidar varias cadenas entre comillas en una sola línea escapando cada nuevo conjunto de comillas con barras invertidas.
bind [key] "bind [key] \"[command/setting] [value]; bind [key] \\\"[command/setting] [value] \\\"\""
A medida que agregas más cadenas, también debes escapar las barras invertidas. Dado que cada capa nueva volverá a eliminar el escape, debes duplicar la cantidad de barras invertidas por capa. La cantidad máxima de capas que puedes usar es 5 antes que la consola dé un error. Esto pasa porque la consola tiene un límite de caracteres de 255. La cantidad de barras invertidas para 6 capas es de 240 (1*2 + 3*2 + 7*2 + 15*2 + 31*2 + 63*2), dejándote solamente con 15 caracteres.
1 = 1 \ 2 = 3 \\\ 3 = 7 \\\\\\\ 4 = 15 \\\\\\\\\\\\\\\ 5 = 31 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Si esto resulta confuso de ver, intenta crear una nueva línea y sangría por cada comilla escapada para tener una idea visual más clara de lo que está pasando.
bind [key] "bind [key] \"[command/setting] [value]; bind [key] \\\"[command/setting] [value]; bind [key] \\\\\\\"[command/setting] [value] \\\\\\\" \\\" \" "
Nota: No puedes ejecutar un archivo de configuración con el mismo formato que el ejemplo de arriba, no funcionará. Este ejemplo es solo para tener una idea visual clara de cómo se construye un bind anidado.
Comandos y configuraciones útiles
Alternantes
Los alternantes (O toggles) son una manera de usar una sola tecla para alternar entre 2 valores para una configuración. Existen dos tipos de alternantes.
- toggle se usa para que cada vez que presiones una tecla, este cambie entre uno de 2 valores para la configuración.
- +toggle se usa para que el primer valor se establezca solo mientras se presiona la tecla y el segundo valor se establezca cuando se suelta la tecla.
bind [key] toggle [setting] [value1] [value2]
bind [key] +toggle [setting] [value1] [value2]
Los alternantes solo funcionan con configuraciones del cliente. No se pueden usar para comandos de chat o del cliente.
Say (Decir)
"Say" es un comando de cliente importante para bindear. Este te permite incorporar comandos de chat al bind, así como solamente enviar texto por el chat.
bind [key] say /[chat command]
bind [key] say [chat message]
Colores
Algunos comandos de cliente te permiten establecer colores.
- player_color_body
- player_color_feet
- cl_message_client_color
son unos pocos ejemplos.
Para obtener el valor correcto del color, ve a Configuraciones > Tee, y usa los sliders para encontrar el color que quieres. Ve a la consola y escribe el comando solo y sin ningún valor para el cual quieres establecer el color. El número que viene después de "Value:" es el que importa.
player_color_body 5635840 o si prefieres el valor hexadecimal: player_color_body $00FF00
También se aceptan algunos valores de colores por nombre (en inglés): red, yellow, green, cyan, blue, magenta, white, gray, black.
Emotes
El comando emote se puede usar para mostrar emoticonos sin usar la rueda de emotes. Cada emote es representado con un número.
emote 0 | oop |
emote 1 | exclamación |
emote 2 | corazones |
emote 3 | lágrima |
emote 4 | puntos |
emote 5 | música |
emote 6 | sorry |
emote 7 | fantasma |
emote 8 | sushi |
emote 9 | splattee |
emote 10 | deviltee |
emote 11 | zomg |
emote 12 | zzz |
emote 13 | wtf |
emote 14 | ojitos |
emote 15 | interrogación |
Por ejemplo:
bind h emote 14
Otros
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 [key] [command/setting] [value] bind [key] 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. To find the right path for your operating system, see Where is the DDNet config, config directory or save directory?
Once the files are in the correct path, you can execute them in the game console with the exec command.
exec [file.cfg]
or
bind [key] exec [file.cfg]
You can use sub-directories within the 'DDNet' or 'Teeworlds' directory to organize files. Just include the path when you execute the file.
bind [key] 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 [key] exec file2.cfg
file2.cfg
[command/setting] [value] [command/setting] [value] [command/setting] [value] bind [key] 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 [key] 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. 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"
Deepfly
The deepfly 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 deepfly with a deep frozen tee, since it can sometimes enable players to do parts in ways that the mapper did not intend. The deepfly 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. There is also a delay between color changes, so changes don't happen the instant you press a key.
Véase también
- Just bind it - Useful binds available for copying
- Take Binding to the next level, with Scripting! - Another forum post about more advanced binds
- Teeworlds New Binding Tutorial by Klex - A video tutorial about binds by KlexMikrowelle