How do I use a script without having to type it in the console row by row?
I've seen plenty of simple scripts, such as "toggle crouch" and etc. that are basically a single row of a bind command.
I've also seen 30+ rows of command that have something to do with some script files (which I assume are somewhere in the TF2 directory).
So, my question is, how do I implement... um... lets use THIS script as an example:
// Spy Attack and Disguise
// =======================
alias +spy_attackdisguise "+attack"
alias -spy_attackdisguise "-attack; lastdisguise"
bind "MOUSE1" +spy_attackdisguise
Also, as an addition to this script, I'd like to know how I can activate/deactivate it with the press of F1.
(My assumption is that you can store a script file and bind its activation and deactivation to the F1 key, probably using the console. P.S. I have no idea what I'm talking about.)
The basic answer is you'd create a config file, put it in the proper place, and then "exec" it when you want to use it.
First, you have to create the file. Any text editor will do, but if you're just using Notepad, I'd suggest upgrading to something like Notepad++.
Enter whatever commands you want to execute (in this case, the block of commands you've already come up with) and then save the file in:
...\steamapps\common\Team Fortress 2\tf\cfg
Once this is done, you can execute the config file by opening the console and typing:
exec myconfigname.cfg
This will run whatever commands are in the file.
Since you can bind commands to keyboard keys, you can extend this to "exec" commands by pressing keys, for instance:
bind "KP_5" "exec myconfigname.cfg"
would make the 5 key on your keypad execute the config file "myconfigname.cfg". Since config files can rebind keys, you can get pretty fancy with turning things on and off - bind a key in each config file that cycles through your configs, for instance.
There's a lot of power in the console (and, by extension, config files) - there's a good tutorial on the Steam forums here which I referenced in making this answer.