How to Script

This section will cover the basics for scripting in Counter-Strike Condition Zero. Many of the previously existing commands and rules that apply to scripting in Counter-Strike are still applicable in Condition Zero. So I will try to only cover the things that separate Condition Zero from the original Counter-Strike.

1. The userconfig.cfg file - Yes, this file is used in CS 1.6 also, but it is important in Condition Zero as well. So I will start the basics off with information about this file. The userconfig.cfg is similar to the autoexec.cfg file from CS 1.5 and older versions of CS. For more information about creating the autoexec, go here. The userconfig.cfg file is a file that is executed during the loading of the game and usually follows the config.cfg file. What this does is actually overwrite settings that were previously set in the config.cfg file. Sometimes the game resets your config.cfg back to default settings, and the only thing saving your settings is your trusty userconfig file.

Since the userconfig is not a default file, you as the user has to create it. You can either copy and rename your config.cfg into it, or make one from scratch with a Text Editor like Windows Notepad. Once you have one make sure it is in the proper directory; for the retail CS:CZ it is something like:

C:\Valve\Condition Zero\czero

Just make sure you place your userconfig.cfg in the same directory as the config.cfg.

For CS:CZ via Steam, the path is something like:

C:\Program Files\Steam\SteamApps\username\condition zero\czero

Once you have your userconfig.cfg created and in the proper directory, you will want to add the settings and binds that you want to retain. You can either cut and paste these from your config.cfg file or type them in manually. Now make sure you save your file, and if using a Text Editor, make sure you use a .cfg extension and not the standard .txt extension. (Note - This is one of the most common mistakes when editing these files)

After that you are basically ready to go. Another good thing to do is to include an echo in your userconfig.cfg so that you can ensure that it properly loads. Add something like this to your file and resave:

echo echo Userconfig loaded . . . . . echo

If you open the console once you start the game, you should see "Userconfig loaded . . . . ." displayed. If you don't see that, your file did not load. You can manually load the file anytime by typing "exec userconfig.cfg" in the console.

2. The Placement

The next important factor with scripting in CS:CZ is the placement of your scripting files. I just want to reiterate that your files need to be in the proper directory or they will not work. Here again are some sample paths for CS:CZ Retail and Steam:

C:\Valve\Condition Zero\czero

C:\Program Files\Steam\SteamApps\condition zero\czero

I like placing my script files in a sub-directory similar to my AutoScript. My script creates it's own directory called autoscript with most of the script-unique files in there. So if I was trying to exec those files I would need to include the full path like this example of executing a file called "scripts":

exec autoscript/scripts.cfg

3. New Commands Now we are going to look at some new things we have seen in CS:CZ. The first thing that comes to my mind is the Buy Presets. This is a great new way to speed up your buying process and get out of the spawn as fast as possible. Now you can even make this process even faster by making direct binds to the presets like:

bind z "buy_preset 1" // Buys Preset #1 bind w "buy_preset 2" // Buys Preset #2 bind x "buy_preset 3" // Buys Preset #3 bind c "buy_preset 4" // Buys Preset #4

Now you might ask me, why do we need to do that? Well, you don't, but depending on the server you are playing on, the buy time will vary, so if you already know what preset you want to buy, why not just hit one key and fly out of the spawn? In CS:CZ like almost no other game, 1-2 seconds is the difference between a Win or Loss, a Kill or Death.

Another cool trick is to make a direct bind for editing the presets:

bind "a" "buy_preset_edit"

You might ask, why would I need to do this? Well, this allows you to actually edit your presets while you are in the Spectator mode or dead. This can come in very handy if you want to switch something in your presets. Once again, this just makes your time in the spawn reduced to just purchasing your equipment, instead of selecting and purchasing which can be time consuming.

The other new command that came along recently was the radartype command. This new command allowed you to finally switch between a solid or semi-transparent radar. The best thing to do in this case is to create a toggle that allows you to switch between the 2 radars with one key:

alias radsw "s_radar" alias s_radar "cl_radartype 1; radsw t_radar" alias t_radar "cl_radartype 0; radsw s_radar"

bind "n" "radsw"

Finally the newest thing to hit the streets was the ability to modify the size and color of your crosshair. The easiest way to adjust the radar size in-game is to create a script that allows you to cycle through the crosshair sizes:

alias "crs" "crs1" alias "crs1" "cl_crosshair_size small; alias crs crs2" alias "crs2" "cl_crosshair_size medium; alias crs crs3" alias "crs3" "cl_crosshair_size large; alias crs crs4" alias "crs4" "cl_crosshair_size medium; alias crs crs1"

bind "g" "crs"

Now the crosshair color can be a little more difficult. The only way you can automate this command is by creating separate cfg files for each color. The command to change the crosshair color is cl_crosshair_color "250 250 50", where the values in quotes are the RGB value of the crosshair. The problem is you have to keep the "RGB" values in the quotes or the game will only recognize the first value. The use of + signs or % symbols between the numbers does not work in this command either. So we are back to the separate cfg files. First in your userconfig, add the following lines:

alias yellow "exec cyellow.cfg" alias orange "exec corange.cfg" alias red "exec cred.cfg" alias magenta "exec cmagenta.cfg" alias blue "exec cblue.cfg" alias ltblue "exec cltblue.cfg" alias green "exec cgreen.cfg" alias white "exec cwhite.cfg" alias gray "exec cgray.cfg" alias black "exec cblack.cfg"

Then create separate cfg files with the one cl_crosshair color line in each of them. The files and the commands are listed below:

/cyellow.cfg cl_crosshair_color "250 250 50"

/corange.cfg cl_crosshair_color "250 128 50"

/cred.cfg cl_crosshair_color "250 50 50"

/cmagenta.cfg cl_crosshair_color "250 50 250"

/cblue.cfg cl_crosshair_color "50 50 250"

/cltblue.cfg cl_crosshair_color "50 250 250"

/cgreen.cfg cl_crosshair_color "50 250 50"

/cwhite.cfg cl_crosshair_color "250 250 250"

/cgray.cfg cl_crosshair_color "192 192 192"

/cblack.cfg cl_crosshair_color "0 0 0"

You can make as many color choices of these as you want, but I have just included the default colors with a few more common ones added. Now the last thing to do is make a color changer that cycles through the colors for you:

alias color_cyc "cyc1" alias cyc1 "yellow; alias color_cyc cyc2" alias cyc2 "orange; alias color_cyc cyc3" alias cyc3 "red; alias color_cyc cyc4" alias cyc4 "magenta; alias color_cyc cyc5" alias cyc5 "blue; alias color_cyc cyc6" alias cyc6 "ltblue; alias color_cyc cyc7" alias cyc7 "green; alias color_cyc cyc8" alias cyc8 "white; alias color_cyc cyc9" alias cyc9 "gray; alias color_cyc cyc10" alias cyc10 "black; alias color_cyc cyc1"

Then finally add the bind and you will be able to cycle through your colors by pressing "c" in this example:

bind "c" "color_cyc"

If you want to see what the RGB values look like, you can use an Imaging program like Paint Shop Pro, or see some examples here.

4. Conclusion This concludes Part 1 of my CS:CZ Scripting Basics. The next part will go more in depth into making other things work like they did in previous versions, like using the kb_act.lst to select your binds, and the commandmenu.

By: SxRxRnR...Posted by: Counter-Script.net

Oh noes! You're not a Member!

Want access to cool stuff? As a member you can:

  • Post. Give the submitter your thoughts on this Tutorial.
  • Say Thanks. Show your appreciation by sending the submitter points.
  • Stamp Posts. Let other posters know what you think of their posts.
  • Rate. Give this Tutorial a rating out of 10.
  • Flag. Alert moderators and warn members of a problem with this Tutorial.
  • Vote. Vote the submitter for the Monthly Awards.
  • Subscribe. Get notified when this submitter submits again.

Interested? Register or Login

Comments

None found

Credits

Key Authors
cWanja
Unknown

Submitter

cWanja avatar
Availability
Offline
Points Level
Drudge Points Level icon
Drudge
4,777 points
Account Age Level
Elder Age Level icon
Elder
9 years old
Clearance Level
Member Clearance Level icon
Member

cWanja
(Creator/Co-creator)

Rating

8.0/10
Based off 1 rating(s)

Details

Genre
Other/Misc
Difficulty Level
Intermediate

Stats

Post Count
0
ViewCount
20,908
Date Added
9 years ago
Date Modified
5 years ago

Share

Code to use:

More embeddable images

Bookmark and Share