Useful commands

Disguising

The disguise command takes two arguments, the first being the class and the second being the team.

Class

1. Scout

2. Sniper

3. Soldier

4. Demoman

5. Medic

6. Heavy

7. Pyro

8. Spy

9. Engineer

Team

1. BLU team

2. RED team

-1. Opposite team

-2. Same team

Thus, disguise 5 1 would disguise as a BLU Medic and disguise 7 -2 would disguise as a friendly Pyro.
Note: disguise 8 -2 (Friendly Spy) will cause the player to un-disguise.

Buildings

The build command takes two arguments, the first being the building and the second being the building type.
build 0 0 will build a Dispenser(Engineer only)build 1 0 will build a teleporter entrance(Engineer only)build 1 1 will build a teleporter exit (Engineer only)build 2 0 will build a Sentry Gun(Engineer only)build 3 0 will build a Sapper(Spy only)

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 Ubercharge.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.

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 script only after a wait testing script.
It is generally considered bad form to have one alias point to itself, as this loop cannot be broken out of and the reset. Therefore, looping scripts tend to include two parts to the loop: The part that waits, and the part that loops.

alias loop "+taunt; wait 132; redirect"
alias redirect loop
bind g "redirect"
bind o "alias redirect break"
alias break "alias redirect loop"
This script will start looping once G is pressed. It will then taunt every 132 frames (2 seconds on most servers). Pressing O would cause the next iteration of the loop to break out. The break alias will then reset the loop, so that next time it is called it will loop again.

Noteworthy scripts

There are several notable scripts that have affected gameplay. Some of these are patched out, while others remain functional.

Patched scripts

Pistol scripts

Originally, the Pistol could be fired almost as fast as the human hand could press a key. Scripts were created to simulate this rapid pressing by holding down a single key.

13 augustus 2009-patch: The Pistol now fires at a fixed rate, not based on the speed at which you press the firing button.

Chargin' Targe turn scripts

Originally, the keyboard commands to turn your viewpoint left and right were not treated the same as the mouse commands. The Chargin' Targe was the first weapon to create a restriction on how quickly you could turn your viewpoint, therefore Valve put a limit on mouse turn-speed, yet forgot to apply the same restriction to the keyboard command that resulted in the same action. Scripts were created to rebind the turning controls when a player charged, circumventing this restriction.

23 juni 2011-patch: Fixed an exploit with the Chargin' Targe that allowed greater turning control than intended.

However, there is still no cap on turn speed when using a gamepad's analog sticks.

Air crouching scripts

Originally, you could crouch as many times as you liked in a single jump. By binding a script to crouch and uncrouch as rapidly as possible, you could exploit the engine and make it difficult to properly register shots on jumping targets.

Gloves of Running Urgently Scripts

The Gloves of Running Urgently used to drain 6 health per second while active. However, jumping preserved the speed bonus granted by this weapon and did not require the weapon to be active. Simple scripting allowed for the player to quickly switch to the gloves, jump, and then switch away.

Current Scripts

Weapon Hiding Scripts

There are a large number of scripts which toggle the weapon display option depending on which weapon slot is selected for a class. Players often make their guns invisible to clear up the screen, but make items like melee weapons, PDAs, watches, and so forth visible because these models indicate important information. For example, the Spy relies heavily on his visible model to determine when he is cloaked, when his Cloak is disturbed, and when the Dead Ringer activates. Other classes use the melee animations to judge when their attacks will hit.

Sentry Jumping Scripts

Since the Engineer Update, Engineers have been able to pack up and carry their Sentry Guns. Simultaneously introduced in the update, the Wrangler allows Engineers to Sentry jump with their Sentry rockets. With extremely fast inputs, it was discovered that a player could Sentry jump and successfully pack up their Sentry before they were launched away.

While a human can repeat this feat, it is difficult. Some players made scripts which could reliably execute the commands in the right order at the right speed allowing them to make a Sentry jump while carrying their Sentry every time.

Note: The Rescue Ranger can circumvent this necessity, as it can pick up buildings at range for 130 metal.

Gunslinger Scripts

Since it can be troublesome to destroy then rebuild a Combat Mini-Sentry in the heat of battle through the PDA, some players have scripted the destruction and rebuilding of their Combat Mini-Sentry with the click of one or two mouse buttons. Such a script is especially useful when using the Frontier Justice, as the player gains practically instant access to revenge crits when needed.

Sensitivity and Control scripts

Some players prefer different mouse sensitivities and control schemes for some classes. For example, changing from the Medic, which doesn't require fine aiming, to the Sniper, which encourages low sensitivity for precise aiming so that a hand twitching inadvertently won't ruin a player's aim too much. These scripts alter control schemes and mouse settings on a per class, or even per weapon, basis.

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 mouse 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.