Half-Life Console Help
alias new_command_name cmd1 ; cmd2 ; . . . ; cmdN ; var1 value1 ; ... ; varN valueNYou may specify only one alias name (new_command_name), and you must specify at least one command OR variable and value. In general you can specify as many commands and variables as you like, but there is a limit to the line length in script files (which is where you'd want to save a really long alias , so keep the total line length under 255 characters or use the workaround, see Debugging Scripts). Why Use
Aliases and Scripts?
If these aliases and scripts still seem a little too complicated, try reading the following explanations of several basic examples. Avoiding
Alias Loops
alias bad_alias "any_commands ; any_variable_settings ; bad_alias"Alias loops will cause problems even if they are not direct like the above example, so be careful to avoid even indirect self-references like this: alias alias1 "any_commands ; any_variable_settings ; alias2"Avoiding Stuck-On +Commands Make sure you don't accidentally make an alias that turns on a +command (for example: +sttack) unless it (or another alias) turns it back off with the -command version (-attack in the example above). For example, never do this: alias bad_alias "+forward; +jump; wait; -jump"This alias, besides being useless (if you need an alias to walk forward and jump, you need to check your keyboard and/or controller configuration :) will cause your player to move forward forever! To stop moving forward (after executing this alias), you'd have to open the console and type -forward or execute another alias that happens to include the -forward command. In the heat of battle, this can be pretty annoying. Worse yet, another symptom of stuck-on command syndrome is that you can't respawn after you die!. In fact, you may not be able to do much of anything except restart the game. Of course, the game will then work fine again, unless you execute the alias again. Let's re-write the alias to be safer (but still useless, really): alias bad_alias "+forward; +jump; wait; -jump; -forward"Now the -forward command at the end will make sure you don't keep moving forward forever, but only if the alias gets that far! True, aliases normally execute ALL of the commands they are set to, but this is not true if you happen to be killed while your alias is executing!. If you die while the "wait" part of the script above is executed (the commmands in quotes are executed one at a time, in the order listed) then you'll be jumping and moving forward forever (or until the -forward and -jump commands are executed). So how can you avoid this hassle? Easy, make a separate config file, say "reset.cfg" and put it in the directory with your other configs (Half-Life/valve or Half-Life/tfc). For every +command you use anywhere in your scripts, put the corresponding -command in this file (except -mlook, -klook, and -jlook), one per line, like this (I've listed them all here, but you probably won't need them all): -attackThen bind a key in your autoexec.cfg to execute this new config file, such as: bind x "exec reset.cfg". Whenever you die in the middle of a script and you can't respawn, just hit X and then respawn (fire). You may also want to put other default settings into your reset.cfg file, especially if you make aliases that change variables from your normal settings like zoom level (fov), mouse sensitivity (sensitivity), or other settings you would only want your aliases to change temporarily.
|