Scripts

From Team Fortress Wiki
< Scripting(Redirected from Medic scripts/es)
Jump to: navigation, search
«
This thing ain't on auto-pilot, son!
El Engineer haciendo salto con arma centinela con un script.
»

Los scrips son parámetros de los archivos de configuración (.cfg) empleados principalmente para asignar teclas, combinaciones y alias, así como automatizar comportamientos complejos y secuencias de comandos de consola. A diferencia de los hacks, los scripts forman parte del código fuente de Team Fortress 2 y no están vetados por el VAC (sistema antitrampas de Valve). El uso de scripts varía desde una simple asignación de un comando a una tecla a alias para redefinir otras combinaciones. Toda combinación que se puede ejecutar mediante la creación de un script, se puede ejecutar sin él. El script simplemente facilita la realización de dicha acción en el fragor de la batalla.


Índice

Scripts de comandos

A continuación se muestra una lista de comandos sin uso, más allá de la elaboración de scripts, por lo que no influyen en la jugabilidad directamente.

Comando «bind»

Este comando es el más simple de todos. Hace que la tecla especificada ejecute la acción deseada. Dicha acción puede ser un ajuste, un comando o un script.

bind [TECLA] [COMANDO]

Se pueden usar comillas acotando la tecla y/o el comando, es algo opcional pero si el comando tiene espacios entre el valor y el comando será obligatorio el uso de las comillas para que la consola lo interprete adecuadamente. Un ejemplo sería «bind mouse1 "say texto"», donde las comillas acotan el comando «say», que envía el mensaje «texto», lo cual pertenece a un mismo comando.

bind [TECLA] "[COMANDO 1];[COMANDO 2];[COMANDO 3]"

Las comillas en la tecla son opcionales, pero en los comandos son obligatorias, si no la consola no los interpretará como comandos consecutivos.

Nota: El comando

say "texto"

es correcto, pero

bind <TECLA> "say "texto""

no lo es. Esto es porque la interpretación de las comillas es errónea y no es necesario que haya comillas entre comillas, ya que eso aborta el comando automáticamente.

Hay dos formas de asignar teclas:

bind e "voicemenu 0 0"

Este método hará que el jugador llame a un Medic al pulsar E.

bind w +forward

Este método hará que el jugador se desplace hacia delante al mantener W.

Comando «toggle»

Este comando permite alternar un ajuste entre dos o más valores.

toggle sv_cheats 0 1

Comando «bindtoggle»

Este comando funciona igual que el anterior, pero se asigna a una tecla.

bindtoggle o sv_cheats 0 1
Nota: Si no se especifica ningún valor, ambos comandos variarán entre 0 y 1 por defecto.

En ambos casos, hay que asegurarse de que los valores están fuera de las comillas ("ejemplo" 0 1).

Comando «incrementvar»

Este comando permite pasar por distintos valores de un comando.

bind MWHEELUP "incrementvar fov_desired 75 90 1"
bind MWHEELDOWN "incrementvar fov_desired 75 90 -1"
comando "<argumento1>" "incrementvar <argumento2> X Y Z"
  • X y Y representan el valor que se quiere ejecutar con <argumento2>.
  • Z es el salto que se hará de un valor a otro.

Si quieres que en un rango de 1-10 se vaya pasando de 2 en 2 valores, las siglas X Y Z equivaldrían a 1 10 2. Cada vez que se ejecute pasara por 2, 4, 6, 8, 10, 2, 4, 6, 8, 10, etc.

Esto es un ejemplo de incrementvar real:

bind "n" "incrementvar net_graphpos 1 3 1"

Esto hace que la tecla "n" haga pasar el net_graph por 1, 2, o 3.

Este ejemplo hará que el campo de visión aumenta al deslizar hacia arriba y disminuya al deslizar hacia abajo.

Nota: Un incrementvar se reiniciará si llega a un valor demasiado alto o pequeño. Es decir, si el campo de visión llega a 90, al seguir aumentándolo el siguiente punto volverá a 75, que es el punto más bajo, y viceversa.

Alias

Un alias permite ejecutar varios comandos referenciados en un mismo comando. Esto se puede considerar como un atajo y es útil cuando es necesario efectuar una serie de comandos en repetidas ocasiones.

Nota: Los nombres de los alias no pueden contener espacios. Pueden contener barras bajas, números y símbolos. Además distinguen entre mayúsculas y minúsculas.
alias Llamar_al_Medic "Voicemenu 0 0"
bind "e" "Llamar_al_Medic"

Esto funcionaría igual que asignar un comando con «bind», pero advirtiendo al juego de que el comando (o conjunto de comandos) es «Llamar_al_Medic».

Nota: Un alias puede tener el símbolo + frente a él (por ejemplo: +Diagonal), de esta manera posteriormente ejecutará su versión en - (en este caso: -Diagonal). Esto es útil para asignar movimientos.
alias "+Diagonal" "+moveleft; +back"
alias "-Diagonal" "-moveleft; -back"
bind "z" "+Diagonal"

Esto permite al jugador moverse diagonalmente. Al pulsar Z el jugador se moverá diagonalmente, hacia atrás y a la izquierda.

Aviso: ¡El siguiente código no funcionará!
bind "z" "+moveleft; +back"

Sin embargo, al pulsar Z el jugador se moverá hacia atrás y a la izquierda, el motor del juego no invierte el comando «+back» ya que sería un segundo comando y al soltar Z no haría que el jugador dejase de caminar hacia atrás.

Comando «exec»

Este comando ejecutará otro archivo. Esto significa que los scripts complejos se puede almacenar en otros archivos, sin ocupar espacio en los generales.

exec autoexec.cfg

Este script ejecutará el script «autoexec» del jugador.

Comando «echo»

Este comando mostrará texto en la consola. Es útil para acciones de depuración.

echo Los scripts son; echo muy útiles.

Esto mostrará en la consola Los scripts son y muy útiles. en dos líneas separadas. Esto es debido a que una nueva línea se añade al final de cualquier texto con echo. Los espacios se analizan si están entre dos palabras, o si el texto con «echo» está entre comillas, como en el siguiente ejemplo:

echo " Los scripts son muy útiles.   "

Los espacios adicionales se mostrarán, ya que la frase está delimitada por las comillas.

Nota: No es posible mostrar el carácter de las comillas ("), ya que su significado quedaría sin interpretación. Pero sí se puede reproducir una sola comilla (') o las comillas españolas (« »), preferiblemente.
Nota: El comando echo puede fallar con textos que no estén delimitados por comillas. Por ello, siempre es preferible acotarlo con comillas, haciéndolo más fácil de entender tanto para la consola como para los humanos.

Comando «wait»

Este comando hará que el juego espere un número de fotogramas hasta ejecutar el siguiente comando.

Aviso: Los comandos de espera están desactivados en algunos servidores. Esto hará que algunos scripts fallen e incluso puede causar (en algunos casos medi raros) que el juego se cuelgue. Véase Pruebas con «wait» para saber cómo proceder.
echo ¿Por qué cruzó la gallina la carretera?;wait 300;echo ¡Para cambiarse de acera!

Este script esperará 300 fotogramas (unos segundos) antes de enviar la segunda línea.

Archivos CFG de clase

Al cambiar a ciertas clases, el juego ejecuta los archivos CFG correspondientes (si los hubiera), con el nombre de la clase escogida.

scout.cfg
soldier.cfg
pyro.cfg
demoman.cfg
heavyweapons.cfg
engineer.cfg
medic.cfg
sniper.cfg
spy.cfg

Esta automatización permite al jugador tener varias asignaciones y ajustes para cada clase.

Opciones de lanzamiento

Las opciones de lanzamiento se pueden usar para alterar la forma en la que TF2 se ejecuta. Ya sea en cuanto a rendimiento o a funcionalidades. Véase Opciones de línea de comandos en la Comunidad de Desarrolladores de Valve para una lista de las opciones de lanzamiento.

Establecer opciones de lanzamiento

Una guía visual sobre cómo establecer opciones de lanzamiento (indicado en círculos rojos).
  1. Haz clic derecho en el título del juego en Biblioteca en Steam y selecciona Propiedades.
  2. En la pestaña General haz clic en el botón Establecer opciones de lanzamiento....
  3. Pon las opciones de lanzamiento que quieras aplicar (asegúrate de separar los códigos con espacios) y haz clic en Aceptar.
  4. Cierra la ventana de Propiedades e inicia el juego.

Opciones de ventana

Esto puede configurarse de forma incorrecta y reducir el rendimiento. Si es posible, es recomendable usar ajustes.

Resolución

Opción de lanzamiento: -w # -h #

Descripción: Fuerza la resolución de ancho y alto en píxeles.

Tasa de refresco

Opción de lanzamiento: -freq #

Descripción: Fuerza la tasa de refresco en hercios.

Modo ventana

Opción de lanzamiento: -windowed

Descripción: Inicia el juego en modo ventana.

Modo ventana sin bordes

Opción de lanzamiento: -noborder

Descripción: Una vez en modo ventana, se pueden eliminar los bordes, para tenerlo pantalla completa sin bordes. En oposición al modo de pantalla completa.

Modo pantalla completa

Opción de lanzamiento: -fullscreen

Descripción: Fuerza la resolución del juego en ancho y alto en píxeles.

Soporte periférico

Desactivar joystick

Opción de lanzamiento: -nojoy

Descripción: Evita que el sistema cargue la compatibilidad con joystick, mejora el tiempo de inicio y minimiza el uso de memoria. No lo uses si sueles utilizar un mando.

Desactivar Steam Controller

Opción de lanzamiento: -nosteamcontroller

Descripción: Evita que el sistema cargue la compatibilidad con Steam Controller, mejora el tiempo de inicio y minimiza el uso de memoria. No lo uses si sueles utilizar el mando de Steam.

Soporte de software

Desactivar SourceTV

Opción de lanzamiento: -nohltv

Descripción: Desactiva el soporte de SourceTV, minimizando el uso de memoria. No lo uses si sueles usar SourceTV en tu cliente.

Desactivar QuickTime

Opción de lanzamiento: -noquicktime

Descripción: Desactiva el soporte de QuickTime, minimizando el uso de memoria. No lo uses si sueles usar QuickTime o exportar archivos .MOV.

Opciones de motor

Desactivar vídeo introductorio

Opción de lanzamiento: -novid

Descripción: Elimina la introducción de Valve al iniciar el juego, mejorando el tiempo de carga.

Cambiar límite de partículas

Opción de lanzamiento: -particles #

Descripción: Limita el número de partículas. Establece # a «1» a (un límite de 512) para mejorar el uso de memoria.

Renderizado de fuente del precaché

Opción de lanzamiento: -precachefontchars

Descripción: Renderiza la fuente del precaché de algunos caracteres, mejorando los tiempos de renderizado.

Desactivar retransmisión de texutras

Opción de lanzamiento: -no_texture_stream

Descripción: Desactiva las carga de texturas de alta calidad, usando otras más modestas. Al desactivarlo se mejorará el rendimiento en sistemas con gráficos más moderados.

Versión de DirectX (exclusivo de Windows)

Opción de lanzamiento: -dxlevel #

Descripción: Establece la versión DirectX del juego; acepta todos los valores, pero solo son efectivos entre 81 y 100.
«-dxlevel 100» usa DirectX 9 y Pixel Shader 3.0. El hardware determina las capacidades gráficas.
«-dxlevel 81» es la versión más estable de DirectX 8 y usa Pixel Shader 1.1. Tiene más rendimiento que las versiones DirectX 9.
Nota: Al iniciar el juego, este se cerrará y se eliminará la opción de lanzamiento para establecer los archivos de configuración relacionados.

Lista de nombres de tecla

Pasa el ratón sobre una tecla para ver el nombre del script. No distingue entre mayúscula y minúscula.

ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12

`   1 2 3 4 5 6 7 8 9 0 - = ← Retroceso

Tab ⇆ Q W E R T Y U I O P [ ] \      

⇪ Bloq Mayús A S D F G H J K L Ñ '   Entrar ↵

Mayús     Z X C V B N M ,   .   /   Mayús        

Ctrl   Alt       Espacio       Alt Menú Ctrl    

Impr pant Bloq Despl Pausa

Insert   Inicio Av pág

Suprimir   Fin   Re pág


                 

         

Num / * -
7 8 9 +
4 5 6
1 2 3
    0     .
Botones de ratón Nombre del botón
Deslizar arriba MWHEELUP
Deslizar abajo MWHEELDOWN
Clic izquierdo MOUSE1
Clic derecho MOUSE2
Clic de la rueda MOUSE3
Clic lateral del ratón 1 MOUSE4
Clic lateral del ratón 2 MOUSE5

Comandos útiles

Artículo principal: Lista de variables y comandos de consola de TF2

Disfraces

El comando disguise tiene dos composiciones, el primero es la clase y el segundo el equipo.

Clase
1. Scout
2. Sniper
3. Soldier
4. Demoman
5. Medic
6. Heavy
7. Pyro
8. Spy
9. Engineer
Equipo
1. BLU
2. RED
-1. Equipo contrario
-2. Mismo equipo

De esta manera, disguise 5 1 disfrazaría de Medic BLU y disguise 7 -2 de Pyro amigo.

Nota: disguise 8 -2 (Spy amigo) hará que se desdisfrace.

Construcciones

Los comandos build y destroy tienen dos composiciones, el primero es la construcción y el segundo el tipo de construcción.

El comando build saca el plano de la construcción.

build 0 0 construye un dispensador (solo Engineer)
build 1 0 construye una entrada de teleportador (solo Engineer)
build 1 1 construye una salida de teleportador (solo Engineer)
build 2 0 construye un arma centinela (solo Engineer)
build 3 0 pone un Zapador (solo Spy)

Del mismo modo, destroy destruirá construcciones.

destroy 0 0 destruirá un dispensador (solo Engineer)
destroy 1 0 destruirá una entrada de teleportador (solo Engineer)
destroy 1 1 destruirá una salida de teleportador (solo Engineer)
destroy 2 0 destruirá un arma centinela (solo Engineer)
Nota: Los Zapadores no se destruyen con comando.

Se pueden usar comandos build antiguos, que solo tienen una composición.

build 0 construirá un dispensador (solo Engineer)
build 1 construirá un teleportador de entrada (solo Engineer)
build 2 construirá un arma centinela (solo Engineer)
build 3 construirá un teleportador de salida (solo Engineer)
build 3 pondrá un Zapador (solo Spy) [fuera de uso]

Menú de voz

El comando voicemenu tiene dos argumentos, el número del menú y del comando.

  • voicemenu 0
    0: ¡MEDIC!
    1: ¡Gracias!
    2: ¡Vamos! ¡Vamos! ¡Vamos!
    3: ¡Moveos!
    4: A la izquierda.
    5: A la derecha.
    6: Sí.
    7: No.
    8: ¡Pásamela!
  • voicemenu 1
    0: Adelante.
    1: ¡Spy!
    2: ¡Centinela al frente!
    3: Teleportador aquí.
    4: Dispensador aquí.
    5: Centinela aquí.
    6: ¡Activa la carga!
    7: MEDIC: Supercarga lista.
    8: ¡Pásamela!
  • voicemenu 2
    0: ¡Ayuda!
    1: Grito de guerra.
    2: Aplausos.
    3: Ovación.
    4: Positivo.
    5: Negativo.
    6: Buen disparo.
    7: Buen trabajo.
Nota: Si quieres abrir el menú de voz en vez de emitir el mensaje voicemenu <núm> <núm>, el comando es voice_menu_<num>: donde <núm> es un número del 1 al 3. Del otro modo, para ver el primer menú de voz, el comando es voice_menu_1.

Teleporte Eureka

El comando eureka_teleport teleporta a un Engineer con el Efecto Eureka a su base o salida del teleportador si la hay.

  • eureka_teleport 0 teleportará al jugador a su base.
  • eureka_teleport 1 teleportará al jugador a su teleportador de salida.

El jugador verá «Unknown command» en la consola aunque funcione.

Clasificación

  • clear borra la información de la consola.
  • alias hace una lista de los alias actuales.
  • fov_desired (20-90) establece el campo de visión.
  • viewmodel_fov establece el campo de visión del modelo en primera persona. Su rango va de 54 a 70.
  • r_drawviewmodel (0/1) muestra (1) u oculta (0) el modelo del arma.
  • lastdisguise hace que el jugador se disfrace del último disfraz utilizado. (solo Spy)
  • load_itempreset (0-3) carga un equipamiento prestablecido [A, B, C, D].
  • say message envía un mensaje al chat público.
  • say_team message envía un mensaje al chat de equipo.
  • say_party message envía un mensaje al chat de grupo.
  • +taunt abre el equipamiento de burlas del persona.
  • +use_action_slot_item hace uso del espacio del objeto de acción.
  • volume (0-1) cambia el volumen del juego.
  • taunt_by_name (name) efectúa una burla específica, con el nombre exacto de la burla, sin abrir el menú de burlas.

Advanced Scripting Techniques

Toggles

It is possible to bind a key to toggle a command which would otherwise be a press and hold command.

bind w toggle_movement
alias toggle_movement enable_movement
alias enable_movement "alias toggle_movement disable_movement;+forward"
alias disable_movement "alias toggle_movement enable_movement;-forward"

This script will cause a press of W to keep the player moving forward until W is pressed again.

Key combinations

It is possible to create a script where pressing one button while another is held down will change the action of the first button.

bind e call
alias call Call_For_Medic
alias Call_For_Medic "voicemenu 0 0"
alias Call_For_Ubercharge "voicemenu 1 6"

At this point, the script will mean that every time E is pressed, the player will call for a Medic. It also has an unused alias to call for an ÜberCharge.

bind shift +toggleState
alias +toggleState "alias call Call_For_Ubercharge"
alias -toggleState "alias call Call_For_Medic"

Now, pressing ⇧ Shift will redirect call to ask for an ubercharge. Releasing ⇧ Shift will make call point back at a Medic call. When ⇧ Shift+E is pressed, the player will call for an Ubercharge, rather than for a Medic. If you want multiple key combination binds connected to the same toggle key you will have to repeat the first step listed before.

bind f thank
alias thank Thank_Player
alias Thank_Player "voicemenu 0 1"
alias Good_Work "voicemenu 2 7"

After this add the same command as what happened in the second step, but alongside the already used command.

bind shift +toggleState
alias +toggleState "alias call Call_For_Ubercharge;alias thank Thank_Player"
alias -toggleState "alias call Call_For_Medic;alias thank Good_Work"

Overall the script should look like:

bind e call
alias call Call_For_Medic
alias Call_For_Medic "voicemenu 0 0"
alias Call_For_Ubercharge "voicemenu 1 6"

bind f thank
alias thank Thank_Player
alias Thank_Player "voicemenu 0 1"
alias Good_Work "voicemenu 2 7"

bind shift +toggleState
alias +toggleState "alias call Call_For_Ubercharge;alias thank Thank_Player"
alias -toggleState "alias call Call_For_Medic;alias thank Good_Work"

Wait-testing

Since the wait command is integral to some scripts, it may be necessary to test to see if a server has disabled the command.

alias waitTester "alias waitTest waitPositive;wait;waitTest"
alias wait "alias waitTest waitNegative"
alias waitPositive "echo Wait is enabled on this server.;exec waitPositive.cfg"
alias waitNegative "echo Wait is DISABLED on this server!;exec waitNegative.cfg"
waitTester

This script relies on the fact that if the wait command is disabled on a server, the alias named wait can be defined by the user. Thus, the script creates an alias named waitTest which by default points to waitPositive, but if wait is not allowed (and can thus be defined by the user), will be redirected to waitNegative.

Loops

Warning: Loops which run without a wait command will cause the TF2 client to hang. It is highly suggested to run a looping script only after a wait testing script.

It is generally considered bad form to have one alias point to itself, as although the loop can be broken out of, it cannot be reset. Therefore, looping scripts tend to include two parts to the loop: The part that waits, and the part that loops.

bind g loopKey
alias loopKey startLoop
alias startLoop "alias loopKey stopLoop;+attack;alias redirect loop;loop"
alias stopLoop "-attack;alias redirect;alias loopKey startLoop"
alias loop "+left;wait 33;-left;+right;wait 33;-right;redirect"

This script will start looping once G is pressed. It begins by firing, and then switches the player's view back and forth every 33 frames (half of a second on most servers). Pressing G would cause the next iteration of the loop to stop, also stopping the firing.

Sequences

alias +pyrocombo "slot1;+attack;wait 32;slot2"
alias -pyrocombo "-attack;slot1"

This script will create two aliases, one to start a sequence, and one to end it. The sequence will switch to a Pyro's Degreaser and fire for 32 ticks, before switching to the Panic Attack and shooting until the button is no longer held. Sequences can also be made like this:


alias quickscope "slot1;+attack2;wait 32;+attack;wait 16;-attack;-attack2"

This script will create a sequence alias, that once activated will cause the Sniper to quick-scope his Sniper Rifle; by executing the long string of commands called a sequence. Sequences are useful in making scripts, and learning how to make one will help in the long run of scripting.

Cycles

A cycle is toggle script where there are a minimum of 3 possible options, which loop (ex, 1, 2, 3, 1). Example:

alias Fov_Cycle Fov1
alias Fov1 "alias Fov_Cycle Fov2;fov_desired 70"
alias Fov2 "alias Fov_Cycle Fov3;fov_desired 80"
alias Fov3 "alias Fov_Cycle Fov1;fov_desired 90"

bind o Fov_Cycle

This script makes it so pressing the O key, FOV values switch between 70, 80, and 90.

Selection addons

A selection script is built onto a cycle to make it more intuitive. Selection scripts allow cycling upwards and downwards, ultimately giving more control for selecting which command(s) to run.

alias CondC_UP Cond1
alias CondC_DOWN Cond5
alias ApplyCond ApplyCond33
alias ApplyCond33 "addcond 33"
alias ApplyCond49 "addcond 49"
alias ApplyCond72 "addcond 72"
alias ApplyCond74 "addcond 74"
alias ApplyCond90 "addcond 90"
alias Cond1 "alias CondC_UP Cond2;alias CondC_DOWN Cond5;alias ApplyCond ApplyCond33"
alias Cond2 "alias CondC_UP Cond3;alias CondC_DOWN Cond1;alias ApplyCond ApplyCond49"
alias Cond3 "alias CondC_UP Cond4;alias CondC_DOWN Cond2;alias ApplyCond ApplyCond72"
alias Cond4 "alias CondC_UP Cond5;alias CondC_DOWN Cond3;alias ApplyCond ApplyCond74"
alias Cond5 "alias CondC_UP Cond1;alias CondC_DOWN Cond4;alias ApplyCond ApplyCond90"

This gives more control in what conditions to add to the player. This also allows for better freedom of selection and ease of use, as it makes scrolling through options in the cycle possible.

Randomization

Randomization is a strange and niche feature. Randomization is rarely used, as most processes aren't as useful when randomized. However, randomization can be useful for chat binds, such as for trade advertising.

Note: Due to the nature of TF2's scripting, this section will be considerably long. If you don't already have an understanding of how cycles work, the information presented may not be relevant.

alias call f1
alias cycle c2

alias c1 "alias cycle c2;alias call f1"
alias c2 "alias cycle c3;alias call f2"
alias c3 "alias cycle c4;alias call f3"
alias c4 "alias cycle c5;alias call f4"
alias c5 "alias cycle c1;alias call f5"

alias f1 "say 1"
alias f2 "say 2"
alias f3 "say 3"
alias f4 "say 4"
alias f5 "say 5"

alias +w "+forward;cycle"
alias -w "-forward;cycle"
alias +a "+moveleft;cycle"
alias -a "-moveleft;cycle"
alias +s "+back;cycle"
alias -s "-back;cycle"
alias +d "+moveright;cycle"
alias -d "-moveright;cycle"

bind o call
bind w +w
bind a +a
bind s +s
bind d +d

This script is assigning and resigning multiple alias values. When any of the WASD keys are pressed, the cycle command is ran, which moves the cycle command to the next value in the cycle and sets the "call" command to a value corresponding to the cycle number. This is based on the player's movement, and only changes values if the player is moving. It is possible to make this randomizer more effective by using other various techniques stated here (ex. Loops), but this example is for demonstration purposes only.

Timed action

Timed or held actions trigger when a button is pressed down for a certain amount of time. Timed actions can be used in situations where a script or command shouldn't be instantly ran the moment a button is pressed (ex. accidentally pressing a disconnect bind).

alias "+ti_zoom" "alias zoom_con zoomOn; wait 132; zoom_con"
alias "-ti_zoom" "zoomOff; alias zoom_con ; rb_tizoom-M4"
alias "rb_tizoom-M4" "unbind mouse4; wait 132; bind mouse4 +ti_zoom"
alias "zoomOn" "fov_desired 20; r_drawviewmodel 0"
alias "zoomOff" "fov_desired 90; r_drawviewmodel 1"
bind "mouse4" "+ti_zoom"

Pressing (and immediately releasing) Mouse 4 with this script loaded will have no noticeable effect, however holding down Mouse 4 for 2 seconds will cause the script to lower the FOV to 20, and hide viewmodels. Letting go of Mouse 4 at any point will undo these changes by setting the FOV to 90 and unhiding viewmodels.

This works because of the use of + and - aliases. Pressing the key +ti_zoom is bound to will redefine zoom_con to activate the script, and if left pressed for the wait duration will execute the script. However, if the button is released, zoom_con is redefined to do nothing. The key is then "disabled" by being unbound for the same wait duration, and rebound afterwards to restore use of the key.

Note: Rebinding of the key is technically redundant, as the script will not execute the timed action if the button is unpressed. However, if the button is pressed multiple times it is possible to execute the timed action if the confirmation alias (in this case, zoom_con is properly defined as any of the presses would execute it. Unbinding the key for the same duraiton of the original wait delay ensures that the effect can't be triggered if the button is rapidly pressed.

Basic Conditionals

The basic conditional allows a script to change its behavior without running an entirely new script. By making use of a dummy alias it is possible to change the outcome of an input based on other inputs. Basic conditionals can support potentially infinitely many checks on the state of other commands, however it's unlikely that a script would need more than a few checks per conditional.

A very basic example of a conditional may look like:

alias "check_test" "check1; check2; test"
alias "check1" ""
alias "check2" ""
alias "test" "success"

alias "fail_check" "alias test failure"

alias "success" "echo SUCCESS!"
alias "failure" "alias test success; echo FAILURE!"

alias "+k" "alias check1 fail_check"
alias "-k" "alias check1"
alias "+j" "alias check2 fail_check"
alias "-j" "alias check2"

bind "l" "check_test"
bind "j" "+j"
bind "k" "+k"

The main function of this script is the check_test alias. When ran, this alias checks the other 2 conditionals, and if the checks succeed it runs the success alias. However, if one of the checks fails, the dummy alias test is pointed to run the failure alias. Simply put, when a check succeeds the checking command doesn't redirect the alias test is pointing to. If a check fails, it redirects the test alias to the alias storing the code to run when the check fails.

In this case, pressing the button L without pressing either J or K, the check succeeds and prints SUCCESS! to the console. When pressing and holding either J or K and then pressing L, the check will fail and print FAILURE! to the console.

A real world example of basic conditionals:

// Change the crosshair color when moving around

alias "+w" "+forward; press_w"
alias "+a" "+moveleft; press_a"
alias "+s" "+back; press_s"
alias "+d" "+moveright; press_d"
alias "-w" "-forward; unpress_w"
alias "-a" "-moveleft; unpress_a"
alias "-s" "-back; unpress_s"
alias "-d" "-moveright; unpress_d"

alias "press_w" "alias check_w pressed_w; chc_forward"
alias "press_a" "alias check_a pressed_a; chc_left"
alias "press_s" "alias check_s pressed_s; chc_back"
alias "press_d" "alias check_d pressed_d; chc_right"
alias "unpress_w" "alias check_w unpressed; check_none"
alias "unpress_a" "alias check_a unpressed; check_none"
alias "unpress_s" "alias check_s unpressed; check_none"
alias "unpress_d" "alias check_d unpressed; check_none"

alias "check_w" "unpressed"
alias "check_a" "unpressed"
alias "check_s" "unpressed"
alias "check_d" "unpressed"

alias "pressed_w" "dchk_fail; chc_forward"
alias "pressed_a" "dchk_fail; chc_left"
alias "pressed_s" "dchk_fail; chc_back"
alias "pressed_d" "dchk_fail; chc_right"
alias "unpressed" ""

alias "check_none" "check_s; check_a; check_d; check_w; dmy_check"
alias "dmy_check" "chc_success"

alias "dchk_fail" "alias dmy_check chc_failure"
alias "dchk_reset" "alias dmy_check chc_success"

alias "chc_failure" "dchk_reset"
alias "chc_success" "chc_default"

alias "chc_default" "color0"
alias "chc_forward" "color1"
alias "chc_left" "color2"
alias "chc_back" "color3"
alias "chc_right" "color4"

// Binds
bind "w" "+w"
bind "a" "+a"
bind "s" "+s"
bind "d" "+d"

// Colors
alias "color0" "cl_crosshair_red 0; cl_crosshair_green 255; cl_crosshair_blue 0"        // Default color when not moving
alias "color1" "cl_crosshair_red 0; cl_crosshair_green 0; cl_crosshair_blue 255"        // Color when moving forward
alias "color2" "cl_crosshair_red 255; cl_crosshair_green 0; cl_crosshair_blue 255"      // Color when moving left
alias "color3" "cl_crosshair_red 128; cl_crosshair_green 212; cl_crosshair_blue 255"    // Color when moving back
alias "color4" "cl_crosshair_red 255; cl_crosshair_green 140; cl_crosshair_blue 25"     // Color when moving right

This script will change the color of the user's crosshair as they walk around with the WASD keys. An important note this script takes advantage of is that when a check fails it can do several things instead of just changing the dummy command for testing. When a check fails the crosshair will change colors, and also change the dummy command to fail the check. This means when several buttons are unpressed, the crosshair's color will properly change to the most recently pressed key.

Commenting

As scripts get longer, the need for well-named aliases grows. However, it is not always sufficient to explain what an alias does simply by its name. Adding a pair of forward slashes (//) will turn the rest of the line into a comment–it will not execute any actions on the text.

voicemenu 1 6 //Activate Charge!

Since it is not obviously clear what the voice command is, a comment can explain it.

Scripts que destacan

Hay varios scripts que destacan por afectar al modo de juego. Algunos han sido parcheados, pero otros aun funcionan.

Scripts parcheados

Scripts de la pistola

Script de la Pistola

Originalmente la Pistola daba un tiro por cada clic. Un usuario hizo un script que permitía mantener pulsado el clic para disparar.

Parche del 13 de agosto de 2009: Ahora la Pistola dispara a una velocidad fija, no depende de la velocidad con la que se haga clic.

Script del giro del Escudo

Originalmente, los comandos de teclado para girar a izquierda y derecha no se consideraban igual que los comandos de ratón. El Targe de Carga fue la primera de las armas en crear una restricción sobre la velocidad de giro, por lo que Valve tuvo que limitar la velocidad del ratón. Sin embargo olvidaron aplicar el límite a los comandos de teclado para la misma acción. Se crearon scripts para controlar el giro durante la carga.

Parche del 23 de junio de 2011: Se corrigió un abuso de la mecánica del juego que permitía que el Targe de Carga tuviera más velocidad de giro.

Scripts de saltar y agacharse

Originalmente, los jugadores pueden agacharse las veces que quieran durante un salto. Al asignar una tecla a agacharse y levantarse a la vez que se salta, se puede lograr ser menos accesible durante los saltos.

Parche del 6 de marzo de 2009: Ahora los jugadores solo se pueden agachar dos veces en el aire.

Idling Scripts

Most servers seek to prevent players idling for drops. Players can try to outsmart these systems with scripts that simulate basic movement.

An Active Solution to an Idle Threat requires players to accept a pop-up notification in order to continue to get drops.

Scripts actuales

Scripts de ocultar arma

Hay gran cantidad de scripts que permiten pulsar una tecla para ocultar el modelo de las manos y el arma en primera persona. Esto puede resultar útil para tener visibilidad en puntos concretos. Aunque con el Spy, por ejemplo, es necesario tener el modelo para ver la carga de invisibilidad del reloj o saber si se lleva el Duplicante activado.

Scripts de aumento

Cambiando el campo de visión, permite que un script haga efecto de zum con cualquier arma.

Scripts de salto con arma centinela

Desde la Actualización del Engineer, los Engineers pueden transportar sus armas centinela. Junto a esa característica se introdujo el Arreo, que permite al Engineer realizar salto con arma centinela con los cohetes de la misma. Con comandos de entrada muy rápidos se puede realizar el salto y guardar la centinela para transportarla durante el salto.

El humano puede replicar esta acción, pero es muy complicado. Algunos jugadores han creado scripts para ejecutar los comandos en el orden específico para automatizar esta función.

Nota: El Rescatadora puede facilitarlo, ya que permite recoger construcciones a distancia por 100 de metal.

Scripts del Forajido

Algunos jugadores no se encontraban satisfechos con la velocidad de construcción de la miniarma centinela, por lo que desarrollaron un script con el que la pueden construir con un solo clic, sin necesidad de sacar la PDA.

Scripts de sensibilidad y control

Algunos jugadores prefieren unos controles o sensibilidades distintas para cada clase, variando de la velocidad del Scout en comparación con el Heavy o el Sniper al apuntar con el rifle. Algunos jugadores han hecho scripts con los que ajustan su sensibilidad con la clase deseada o incluso un arma específica.

Charge Dash Scripts

Since timing a charge and jump can be difficult, some players may use a quick script that binds the two actions to a button so that the charge dash will cover the maximum amount of distance possible. The player is still required to swing their melee weapon normally to end the charge though.

Quickscope Scripts

Many players find it difficult to scope in and fire straight after to get a quick headshot. There are scripts that will zoom in and fire just by clicking one button. This does require players to aim outside of the scope, though.

Rocket Jump Scripts

In order to Rocket Jump to a maximum height or distance, it is required that the player jumps, crouches, and fires their rocket at roughly the same time. This can be easily scripted to occur with the press of a button.

Auto-Disguise Scripts

For Spies who find manually disguising to be a hassle, this script automatically disguises as a chosen class after the player attacks with any weapon. Auto-disguise can usually be toggled and customized to choose a disguise to use.

ÜberCharge Broadcasting Scripts

With this script, activating ÜberCharge as Medic will also write a custom message in team chat to alert your teammates about your activation, in order to encourage your team to push ahead with you. A similar script, upon activation, plays the "ÜberCharge Ready" voice command while writing in team chat that you faked your Über to fool the enemy team.

Medic Radar

This script only works for Medic, as it lets you press a button to temporarily set the autocall percentage to a very high number. This makes it so that you can see the locations of nearby teammates. Script:

alias "autocall_default" "hud_medicautocallersthreshold 75.730003/Custom Threshold"
alias "autocall_all" "hud_medicautocallersthreshold 150"
alias "+radar" "autocall_all"
alias "-radar" "autocall_default"
bind [KEY] "+radar

Kill-Bind Scripts

Artículo principal: Suicide

In certain circumstances, such as when cornered by a Medic wielding the Übersaw, it can be beneficial for a class to be able to kill themselves quickly (in this case, to deny the Medic Über) with a key bind (for example, bind k kill). Although mostly only relevant in competitive play, there are occasional uses in public servers, often for comedic effect instead of to benefit gameplay. The killbind can be set to explode you if you use explode instead (for example, bind k explode). There is no difference between these two mechanically.

Null-Cancelling Movement Scripts

In stock TF2, pressing two opposing movement keys at once (such as "A" (+moveleft) and "D" (+moveright)) will cancel all movement and render the player immobile, which can be a fatal mistake during battle. This script makes it so that the direction of the last key pressed will be used instead. For example, pressing "A" will make the player go left, and pressing "D" while still holding "A" will make the player go right instead of stopping.

Chat Bind Scripts

Chat bind scripts are designed to post a pre-written message in the in-game text chat. Typically, users will bind these scripts to a key on their keyboard for easy repitition. These scripts can vary from user-to-user, and can say anything within the text limit, depending on what a player would want to say. Some common binds are used for team co-ordination, such as a bind to tell a team that their Medic has popped an ÜberCharge. Other common binds are used for banter, such as messages upon kills and/or dominations. Another variation on this is a trade offer bind, where it sends information to the chat about a possible trade offer. This type of script can also be automated to send these offers every couple of minutes.

Voice Toggle

This script enables you to voice toggle, instead of push-to-talk. Script:

bind [KEY] mic_toggle
alias mic_toggle mic_enable
alias mic_enable "+voicerecord; alias mic_toggle mic_disable"
alias mic_disable "-voicerecord; alias mic_toggle mic_enable"

Notas

  • Cada archivo de configuración se limita a un mebibyte (1,04858 MB) de información, dicha restricción se puede sortear ejecutando otro archivo de configuración al final del primero.

Veasé también

Enlaces externos