Scripting Commands

Command Reference

The following is an excerpt of commands available to you for scripting,
refer to your local documentation to find out all commands available.
On this page you will find commands and examples of usage to help get you into CubeScript.
Almost all commands can be used in scripting, although a map-cfg cannot override persitent values - including among others watersubdiv, waterlod, maxparticledistance and fov among others.
You can't override them in a map-cfg - a message will be output to your console in such cases -
you can only set them manually. It counts as a manual setting if used via the menu!

exec C

Executes all commands in config file C.

history N

Executes the Nth command in the command line history. For example, binding "history 0" to a key allows you to quickly repeat the last command typed in (useful for placing many identical entities etc.)

saycommand P...

This puts a prompt on screen where you can type stuff into, which will capture all keystrokes until you press return (or esc to cancel). You may press tab to autocomplete commands/aliases/variables, and up/down keys to browse the command history. If what you typed started with a "/", the rest of it will be executed as a command, otherwise its something you "say" to all players. default key = T for talk, ` for commands. If P is prefix to insert to the buffer, (default key ` inserts a /).

The following example will prepare one of three messages to be output via say, but don't be fooled, you can execute anything else besides say with this too.
It binds the key K to prepare the command onto the console upon release of the key.
You will only see a beautified display - for example : GREET #2
But if you confirm the command, it will execute the prepared saycommand.

Tries to select weapons a, b & c, in that order, if they have ammo ( 0 =`` fist, 1 ``=`` sg, 2 ``=`` cg, 3 ``=`` rl, 4 ``=`` rifle, 5 ``= gl ). If none of the 3 indicated have any ammo, it will try the remaining weapons for one with ammo (in order 3/2/1/4/0) (the fist needs no ammo). You can use the weapon command with 0 to 3 arguments. examples:

In any selection, it will skip whichever weapon you have currently selected, so executing a weapon command repeatedly toggles between the two best weapons with ammo within a given selection. default keys 0 to 4 select the corresponding weapons, with sensible default alternatives, middle mouse button is a simple weapon switch.

alias N A
N = A

Binds name N to commands A, after which you can use N as a shortcut for A. You may re-bind N as often as you like, call it recursively etc. You may use N = A as a shortcut for alias.

keymap K N A
// for players using a german keyboard the following keymappings can be added to data/keymap.cfg
keymap 223 SZ
keymap 252 UE
keymap 246 OE
keymap 228 AE

Sets up the keymap for key code K with name N and default action A. You should never have to use this command manually, use "bind" instead. But in case you do need it (to make use of previously un-bind-able keys (like above)) take a look at Internationalization

// for people uncomfortable with using "BACKQUOTE":
bind CARET [saycommand /]