One of the nicest things about the Counter-Strike series of games is the ability to customize your interface using scripts.
For those unaware of how to use scripts there are basically three kinds of statements:
Variable assignment
Alone these variables are not so useful; however, used in one of the following statements they can be much more powerful.
1 2 | fps_max "72" volume "0.2" |
Bind statments
You can associate a statement with a key by using the bind command.
The following command will bind a statement to the F12 key which will mute the volume.
1 | bind F11 "volume 0.0" |
Alias statements
This is the closest that you’re going to get to a function. As long as you can accept the idea that this is a sequence of commands delimited by a ‘;’ symbol that takes no parameters and cannot read variables.
1 2 3 4 5 | volume "0.2" // Setting default volume. alias volume_mute "volume 0.0" alias volume_restore "volume 0.2" bind F11 "volume_mute" bind F12 "volume_restore" |
With these two commands we can now mute the volume in the console by typing volume_mute and similarly we can restore the volume using volume_restore
There is a second kind of alias that you can implement which involves prepending the alias name with either the ‘+’ or ‘-’ operators. An example of this is +attack which is provided by the game to allow you to fire. Binding +attack to a key causes that key to fire while depressed and cease firing when released.
Lets say we only want the volume to be muted while we hold down the F11 key. We can define an alias as following and bind it to F11.
1 2 3 | alias +temp_mute "volume 0.0" alias -temp_mute "volume 0.2" bind F11 "+temp_mute" |
Alternatively, if we desire to have the bind act as a toggle then we have to introduce a method of keeping track of state into our aliases. This is done by defining a third alias and then dynamically setting this alias depending on state.
1 2 3 4 | volume "0.2" // Setting default volume. alias volume_toggle "volume_mute" alias volume_mute "alias volume_toggle volume_restore; volume 0.0" alias volume_restore "alias volume_toggle volume_mute; volume 0.2" |
On line 1 we ensure that the volume is enabled.
On line 2 we set the default action for the mute toggle to mute the volume (which is the opposite of the current state.)
Lines 3 and 4 define an alias to perform an action and set the toggle to perform the opposite action.
Now when we hit F12 it toggles the ingame volume.
Setting up CS 1.6 to automatically use your scripts on every load
If you place your scripts in a file called ‘userconfig.cfg’ and place the file in your ‘cstrike’ directory your scripts will be executed on every run.
Alternatively, you can run scripts through the console by using exec scriptname.ext.
You can find the scripts that I use and my configuration here.
Pages: 1 2