| Users Guide - Page 3 |
Page 3 of 7 Scripting in Half-Life Mods (such as Counter-Strike and Condition Zero) can be broken down into 2 different parts.
Aliases are a way to create a command from one or more other commands. Aliases are often used with binds to connect a key being pressed to a command or sequence of commands. Lets look at a bind. bind "w" "+forward" the first word in this is the word "bind" this lets the game know that when ever the letter to its right is pressed it needs to execute the forward command. the + symbol plays a special role in binding and is a symbol that denotes "while the key is pressed down, do this command. when the key is released (comes back up) stop doing this command." We'll talk more about this when we discuss aliases. CZ Bind Maker allows you to make buy scripts by selecting a key to bind, to one or more items from the bind items list. More detail on creating buy scripts with Bind Maker can be found on the link titled "creating a buy script." Buy scripts allow you to buy a weapon (or your entire setup) with a press of a single button. bind "F1" "deagle; secammo; vesthelm;vest;" This script will purchase a desert eagle, full secondary ammo, a vest and helmet (or if you're too poor for that, just a Kevlar vest). This script can very easily be made using CZ Bind Maker.
alias walk_t walk_on As its name suggests this alias toggles the name "walk_t" (short for walk_toggle) between "walk_on" and "walk_off." walk_on and walk_off are also aliases. the main thing that walk_on does is execute the +speed command. In Counter-Strike and Condition Zero, this command allows you to walk when you hold down the walk button. If you were to type +speed in your console, you would notice that your player would continuously walk. This happens because you used a key up/down alias without pressing a key. when you script in a +command it does the same as a built in toggle. So here we're toggling the walk command. walk_on starts the walking and walk_off stops it (-speed). The next type of alias is the key up / down ( + & - ) alias. Again this is a special naming convention. It tells the game that when the key is pressed down to do a certain command and to do another set of commands when the key goes back up. Here's an example of a key up / down alias: alias +clean_scores "+showscores; hud_saytext_internal 0;" "+showscores" shows the score board when you press the button. hud_saytext_internal is an in-game variable (0 for off, 1 for on) that determines whether or not the in-game chat is shown. This alias shows the scores and turns off the chat board while the button is pressed down. when you let go of the button the chat board comes back up and the score board goes away. These 2 things can be combined to create powerful and useful scripts. They form the basis for every script used in any Half-Life mod. |

Documentation

