Using the Console
Using commands on the console
From your local documentation (README.html) you can always find out which commands the engine will react to!
Single commands you enter into your console. Open your console with the / key. Or use a short script that is bound to the BACKQUOTE key:
bind BACKQUOTE [saycommand /] // for some language layouts, this is unusable, so bind your own: bind CARET [saycommand /]
While entering the first word on the console and you're to lazy to type in a full command, say thirdpersondistance, you can auto-complete it with the TAB key. This also works for the map names in the map command, by the way.
Everything following a command we call parameters or arguments. Some commands take parameters, some don't, some even behave differently depending on which way you call them. For example the fov command will -- by itself -- output the current FOV value, called with an integer parameter it will try to set your current field of view. If you passed an illegal value here, so something outside the allowed range, it will also output which values it accepts. Other commands like this include particlesize, crosshairsize and skill (among others).
Most commands will not output anything if they are called correctly. A noteable exception is the fullscreenshader command. This will output the succesfully activated shader -- but conversely nothing if it fails. Since some shading FX are subtle to spot and still some graphics cards can't display them. So it's probably for the best this way around.
Another important feature of the console is the command history; by pressing the up arrow you can jump back to previous commands.
Tired of typing?
So, you got the hang of the console? Now you find yourself typing the same stuff again and again -- and you're tired of it? Then it's a good time for a script!
For example: Say as an editor you've repeatedly had to tune your light entities to get the ambience of your map just right. Well, you could of course execute three seperate entproperty commands -- which can be done pretty quickly with the help of the command history -- but that's not the end of your laziness, right? Right!
So you want to have that yellow light entity with properties 64 256 256 192 be about half as bright?
loop i 3 [entproperty (+ $i 1) -128]
and you're done.
The loop will evaluate the body (the stuff inside [ ]) 3 times. Each iteration runs with an incremented value of i. In the first loop it is 0, but since we want to modify entproperty 1 to entproperty 3 we need to increment it still further -- this is done inside the ( and ) where we use the + operator to result in the sum of i and 1. So. the above line is the same as typing
entproperty 1 -128 entproperty 2 -128 entproperty 3 -128
In our above example the light entity would end up having the attributes 64 128 128 64.