Half-Life Aliases and Scripts

Note: Half-Life provides a relatively powerful console scripting language that you can use to create handy scripts and aliases that can automatically do anything you could do by typing commands into the console. Script files are just lists of console commands and variable settings -- there's no real flow control, so commands are executed one after the other (separated by semicolons or linebreaks), in the order listed. If you're unfamiliar with the console, I strongly suggest reading the Comprehensive Guide to the Console before you try to use any of these scripts. It's not hard to learn, and it will make it much easier for you to get these scripts working well and modify them to suit your personal needs and preferences.

How To Install a Script: Just highlight and copy the script you like from your browser window. Make sure your browser window is wide enough so that none of the lines wrap (or be sure to edit those extra linebreaks out after pasting -- if you're not sure where the linebreaks shoud be, please read the Comprehensive Guide to the Console) Paste the script into a text file (you can use Windows Notepad for this), and save it (or copy it to) your Half-Life/valve/ folder. If you want to use a script in a mod (such as TFC, CounterStrike or Opposing Force), put the text file in the folder for that mod instead (tfc\, cstrike\, and gearbox\ for the examples mentioned). You can name the text file anything you want, but most people use the .cfg extension (as in myscript.cfg). 

How To Use a Script: To execute the commands and settings in a script file names myscript.cfg, just open the console and type exec myscript.cfg and then press return. If you have a script file you use a lot, you can even bind a key to the exec command, as in bind x "exec myscript.cfg so that pressing it executes the script. If you really use the script a lot, you may want to put it in the Half-Life/Half-Life/autoexe.cfg file so that it is executed every time the game is loaded. If you want a script to be executed automatically only when you're playing a class, put it in the appropriate class.cfg file (such as spy.cfg, or soldier.cfg). You can also have scripts that run only when a certain map is loaded by putting them in a mapname.cfg file (such as 2fort.cfg). (Note: if class.cfg and map.cfg files aren't executing automatically for you, try adding this line to the beginning of your autoexec.cfg file: setinfo exec_class on; setinfo exec_map on; Always back up your config files!

If You Have Problems: All of these scripts are tested, but it's important to note that certain types of scripts can behave differently under different network lag conditions (higher or lower ping). Scripts that control the player in some way, either moving forward or back, changing weapons, selecting a menu item, or a combination of those such as rocket-jumping may not work correctly if your ping/lag is too high. See the Comprehensive Guide to the Console for an explanation of why this is true and several suggestions for working around it and tweaking scripts for use in high-lag conditions. Also be sure to check out the troubleshooting section of the Console Guide and see the FAQ for help.