Main menu

Tutorial

Examples

 


Tutorial

For those of you out there who are new to Quake 2, we'll start at the beginning, but we'll go quickly. If there is terminology used here which you do not understand, take a look at the glossary. It is a good idea to familiarise yourself with the console section of this site first to understand commands.
This is more of a tutorial than a resource. If you are looking for script snippets then this is not the right place - take a look at my examples and my config file zip in the downloads section.

What is a config file?

A config file is simply a list of commands. You run it with the exec command and it is processed by Quake 2 a line at a time, just as if you were typing in each line at the console.
For example, config.cfg is a list of commands generated by Quake 2. It is run every time Quake 2 loads, it is saved every time Quake 2 quits. Because of this, it is a good idea not to mess with it too much.
The maximum file size for a config file is 8kb. If yours goes above this limit, you can get around it by linking two or more files together; simple put an exec at the end of your first config file.

The Basics

There are two main config files you will use; config.cfg and autoexec.cfg.
As I have said before, config.cfg is automatically generated by Quake 2, so don't mess with it. Autoexec is automatically run whenever config is run, so anything you want to change, change it in autoexec.
A useful idea I picked up somewhere was to have a very simple autoexec file which runs another config file, like so:

// baseq2: autoexec.cfg for Radiac
exec radiac.cfg

This is good because it allows you to have just one config file which you change, rather than having 5 or 6 in various patch directories and having to remember which one to copy where. There is only one radiac.cfg in my Quake 2 directory, and that is in baseq2, because remember; it will only go looking for it in the baseq2 directory if it cant find it in firstly the game directory and secondly a pak file.
Anything specific to each patch would then be added to the end of the autoexec.cfg in that patch, for example my eraser autoexec.cfg file is:

// eraser: autoexec.cfg for Radiac
exec radiac.cfg

// eraser specific settings
bind INS defendbase
bind HOME freestyle
bind PG_UP rushbase

Now when I want to change my shift key from walking to crouching, I only have to change one line in baseq2/radiac.cfg, rather than going through all my patches and updating those files.

Now we've got it running radiac.cfg, we've gotta start thinking what we're going to put in it.
I happen to know that my config file is bigger than 8kb, so what I have are a long list of execs running various other config files. I have put them all in a directory called Radiac for neatness, so my radiac.cfg file reads summat like:

// radiac.cfg for Radiac
exec radiac/talk.cfg
exec radiac/screen.cfg
exec radiac/weapons.cfg
exec radiac/misc.cfg

If you think your config file is going to be huge, this is a good idea, but if all you want are a couple of insults and a bit of weapon swapping, don't bother going to this extreme. 8kb is a hellova lot of words...

An important thing to remember is that a semicolon (;) moves to a new line - I know of no way in which you can have a semicolon without it having this effect. Hence you will never be able to do one of those cool little ;) which are so very useful.

Smart guy, huh?

For our first bit of real config stuff, let's write an insult thing.
For a straight-forward insult, we could have something like:

bind Q "say Um, that was the wall, I'm over here..."

This simply tells Quake 2 to say to everyone our insult whenever you press Q.
But I think you'll agree, this is a bit lame. If that was all you ever said, people would think 'Oh my god, they can only ever say that, they are so boring'. You don't want to ruin your reputation, so lets make it more interesting - lets put it on a loop.

A Loop A Loop A

Loops are very very useful. They are probably the most useful thing you are ever going to use.
There are two different types of loop. They both use the alias command which will joins a series of commands into one command. The difference is one rebinds the main key - I call this The Bind Method:

alias insult1 "say Um, that was the wall, I'm over here...;bind Q insult2"
alias insult2 "say What's wrong, your mouseball missing?;bind Q insult3"
alias insult3 "say Next you'll be asking me to stand still...;bind Q insult1"
bind Q insult1

The other version uses another alias, and imho works better, because it lets you change the key bind in one line rather than in each alias. I call it The Alias Method

alias insult1 "say Um, that was the wall, I'm over here...;alias insult insult2"
alias insult2 "say What's wrong, your mouseball missing?;alias insult insult3"
alias insult3 "say Next you'll be asking me to stand still...;alias insult insult1"
alias insult insult1
bind Q insult

Now this second version may be longer and therefore seemingly less efficient (and therefore against the Programmers Ethics Act), but hey, it'll end up saving you time and so in this case it's excuseable.

So there you are...

To make sure you've got this loop thing, here's another one for you, with a fairly common-sense suggestion, but one which you might not have thought of.
This one is a zoom function which really only works well with an intellimouse. And it works very well.
What we do first is fairly ugly. I've got my zoom set up with FOV increments of 10, but I won't put it all here.
Basically what we do is set up each FOV in an alias. Then we have to tell it where it is going to go from there, and we should let us know where it is.

alias zoom20 "fov 20;echo 20;alias zoomin zoom90;alias zoomout zoom50"
alias zoom50 "fov 50;echo 50;alias zoomin zoom20;alias zoomout zoom80"
alias zoom80 "fov 80;echo 80;alias zoomin zoom50;alias zoomout zoom90"
alias zoom90 "fov 90;echo 90;alias zoomin zoom80;alias zoomout zoom20"

From here we can go two ways. As you can see, it's pretty obvious we need to bind something to both zoomin and zoomout, and it might be an idea to bind something to zoom90 in case we start to feel the effects of a hyperblaster. So:

bind MWHEELUP zoomin
bind MWHEELDOWN zoomout
bind MOUSE3 zoom90

Then we have to define zoomin and zoomout. So, cue cunning trick; call zoom90. So the full thing looks like:

alias zoom20 "fov 20;echo 20;alias zoomin zoom90;alias zoomout zoom50"
alias zoom50 "fov 50;echo 50;alias zoomin zoom20;alias zoomout zoom80"
alias zoom80 "fov 80;echo 80;alias zoomin zoom50;alias zoomout zoom90"
alias zoom90 "fov 90;echo 90;alias zoomin zoom80;alias zoomout zoom20"
zoom90
bind MWHEELUP zoomin
bind MWHEELDOWN zoomout
bind MOUSE3 zoom90

This can then be modified so that you have all FOVs between 10 and 90 mapped, it changes the crosshair when it zooms in etc.

The Positive Effect

Say you don't have an intellimouse. But say you need to zoom. You have two choices. Have one key as a zoom in, one as a zoom out, a third as a reset. This is simply the same as above, but with the binds on different keys. Problem with this is it's not very safe - very easy to get trapped in FOV 30 when someone drops down next to you.
The other way is one key zooms in. Let go, it zooms out again.
This is obviously not only useful in this situation. You could modify the intellimouse function so that when you hold down MOUSE3 and scroll, it changes weapon, let go, it sets FOV 90.
Anyway, here is how we do it for the zoom:

alias +zoom "fov 20"
alias -zoom "fov 90"
bind E +zoom

Sweet and simple. If you bind something to an alias which has a '+' prefix, the corresponding alias with a '-' prefix will be executed when the key is released.
Trust me - you'll use this one a lot.

Variables

Variables are able to store text or numbers, and they may be used in commands or as commands.
You set a variable using, surprisingly, the set command.
A couple of simple examples:

set thingy god
$thingy

This will simply execute the command god.

set thingy "ive all"
g$thingy

This will simply execute the command give all.
We can use this in conjunction with a couple of binds and aliases for a more useful effect:

set weap use
bind c "set weap drop"
bind 1 "use blaster;set weap use"
bind 2 "weap2$weap"
bind 3 "weap3$weap"
bind 4 "weap4$weap"
bind 5 "weap5$weap"
alias weap2use "use shotgun"
alias weap3use "use super shotgun"
alias weap4use "use machinegun"
alias weap5use "use chaingun"
alias weap2drop "drop shotgun"
alias weap3drop "drop super shotgun"
alias weap4drop "drop machinegun"
alias weap5drop "drop chaingun"

This one, with a bit of addition and modification, will set you on the path to being your team-mates' best friend. I've got my weapon effects on an alias loop where I can lob out weapons, ammo or both, and I can ask my team-mates for them too.

Help!!!

On a slightly different tack now, if you are playing teamplay, you will probably find the need to ask your team-mates for help, or at least let them know where you are so they don't shoot you.
As you should already know, the command to talk to people on your team is say_team. Here are some useful bits for your say_teams:

%L - Location
%W - Current weapon
%A - Armour level
%H - Health level
%T - Current powerup

These are used like this:

bind I "say_team Gimme summat better than %W - I'm %L"
bind O "say_team I am %L using a %W with %A, %H and %T"
bind P "say_team HELP!!! I'm %L with %H!!!"

Ideas

For some pre-made scripty bits for your own config files and some inspiration for your own scripts, download my config file zip from the downloads section and look at the config demos page.




This page must not be duplicated without prior consent given by the author