Console commands
Console Commands are used to alter the way ZDoom does something, such as changing the sound volume, changing DMflags, ect...
you access the console by pressing "~" at any time
Console variable types
There are six types of cvars: Boolean, Integer, Float, String, Colour and Flag.
boolean
This type of variable represents a yes/no or on/off value. It can only be set to true or false. As shorthand, setting a boolean variable to 0 will set it to false, and setting it to anything non-zero will set it to true.
integer
This is an ordinary number without a decimal point. For example, 1 is an integer, but 1.2 is not.
float
This is an ordinary number that can have a decimal point.
string
This is a series of text characters enclosed in quotes: For example, "Felix loitered lecherously on the lot" is a string. If you removed the quotes around it, then it would not be a string. If you need to use quotes inside a string, preface it with a backslash.
Are you "The One" of old?
would be written like this as a string:
"Are you \"The One\" of old?"
colour
This type of variable is a series of three hexadecimal numbers representing the amounts of red, green, and blue (in that order) in a color. For example, pure red would be represented as "ff 00 00". As a shorthand, you can set a color variable with one of several color names, and the RGB values will be set for you.
flag
This type of variable mirrors a setting in dmflags or dmflags2. Setting its value will set the corresponding value in one of those variables, and getting its value will get the corresponding value from one of the other two variables. This is designed to make using dmflags easier, because you don't have to memorize any numbers.
Button Commands
Button commands are commands that represent buttons and come in pairs. Each "button" has a command prefixed by a + and another corresponding command prefixed by a -. The + version of the command simulates pushing the button, and the - version of the command simulates releasing the button.
When you bind a command that begins with + to a key, releasing the key will automatically execute the same command with the + replaced by a -. Note that this works for aliases as well as the commands listed here. This provides a useful way to bind multiple actions to a single key. Suppose you want the normal Doom behavior of moving forward and using when you double click the right mouse button. If you use the commands
bind mouse2 +forward
doublebind mouse2 +use
ZDoom will move you forward when you press the right mouse button. When you double click it, you will press use, but you will not move forward. To simulate the standard Doom behavior, you can replace the doublebind command with these three commands instead:
alias +useforward "+use; +forward"
alias -useforward "-use; -forward"
doublebind mouse2 +useforward
Now when you double click the right mouse button, the +useforward alias will be executed. Because +useforward's name begins with a + releasing the right mouse button will execute the -useforward alias (whether or not -useforward is defined).
This behavior of executing a - command when a key is released applies only to the first command or alias bound to the key. If you bind a key to "+forward; +right", releasing the key will execute the command "-forward; +right" and not "-forward; -right". As shown above, you can use aliases to get the correct behavior.
Another trick you can do with aliases is to create a key that only executes the + command without executing the - command. If you wanted a key that will make you move forward when you press it, and will keep you moving forward even after releasing it, you can use an alias like this:
alias go "+forward"
Then instead of binding +forward to a key, you bind go to the key instead. This works because go does not begin with a + so nothing will happen when you release the keyZDoom only looks at the command actually bound to the key to determine if it should execute a - command when the key is released; it does not look inside aliases.
Standard buttons
+attack Use your weapon.
-attack Stop using your weapon.
+use Start trying to use anything in front of you.
-use Stop trying to use anything in front of you.
+back Move backward.
-back Stop moving backward.
+forward Move forward.
-forward Stop moving forward.
+jump Start jumping.
-jump Stop jumping.
+left Start turning left.
-left Stop turning left.
+right Start turning right.
-right Stop turning right.
+moveleft Start strafing left.
-moveleft Stop strafing left.
+moveright Start strafing right.
-moveright Stop strafing right.
+lookdown Start lowering your view.
-lookdown Stop lowering your view.
+lookup Start raising your view.
-lookup Stop raising your view.
+movedown Start moving down if swimming or flying.
-movedown Stop moving down.
+moveup Start moving up if swimming or flying.
-moveup Stop moving up if swimming or flying.
+strafe Causes +left and +right to behave like +moveleft and +moveright;
-strafe Returns +left and +right to their normal behavior.
+klook Causes +forward and +back to act like +lookup and +lookdown instead.
-klook Returns +forward and +back to their normal behavior.
+mlook Moving the mouse up and down will make you look up and down.
-mlook Moving the mouse up and down will make you move forward and backward. However, if freelook is true, then moving the mouse up and down will still change your view instead of moving you.
+showscores Display a scorelist for deathmatch games.
-showscores Hide the deathmatch scorelist.
+speed Start running.
-speed Start walking.
Customization
This command does two things. First, it adds a new heading called menu-heading to the controls menu. You can use the addmenukey command to add your own custom keys beneath this heading. Second, it loads all the bindings from the corresponding ini-section-name section in zdoom.ini. You can use this command multiple times to create different sections in the menu and ini for different sets of commands. If you use a menu-heading that was already added to the menu, new controls added with addmenukey will appear at the end of that section, but the bindings will not be reloaded from the ini.
Adds a new control to the controls menu. Description is the name of this control in the menu, and command is a console command or alias to be executed when the control is pressed. New controls are added to the last section specified with addkeysection.
addslot (slot) (weapon)
Adds a single weapon to the list of weapons in a weapon slot.
alias (new-command) [command-string]
If specified with no parameters, will display a list of all current aliases. If only new-command is specified, it will be removed from the list of aliases. If command-string is also specified, it will be added to the list of aliases as new-command. For example, to create a new command to kill the monsters on the level, you can use the command: alias massacre "kill monsters"Then you can use the newly created massacre command to kill all the monsters on the level.
archivecvar (cvar)
When you create a custom cvar with the set command, it will not normally be saved in the ini. You can use archivecvar after creating the cvar to indicate that the custom cvar's value should persist even after you quit.
atexit [command]
If you specify a command, it will be added to a list of console commands to execute when the user quits the game. Commands are executed in the reverse order that they were added in. If you do not specify any arguments to atexit, then it will list the current set of commands that will execute when you quit.
bind (key [command string])
If no parameters are specified, the entire list of bound keys will be printed to the console. If only [key] is specified, the binding for that specific key will be printed. If both [key] and [command string] are specified, [command string] will be bound to [key].
binddefaults
Binds all keys to their default commands. This will not unbind any keys that do not have any default bindings, so if you want to properly restore the default controls, you need to use unbindall first. defaultbind key command Binds command to the key if and only if key is not already bound and there are no keys already bound to command.
doublebind (key [command string])
This command works just like bind, except it controls the action that occurs when a key is double-clicked. If a key does not have a doublebinding, then double-clicking it has the same result as pressing it twice. Otherwise, the first press will execute the normal command set with bind, and the second press of the double-click will execute the command set with doublebind.
eval expression [variable]
Evaluates a mathematical expression and either prints it to the console or stores it in variable. Expressions are written using prefix notation instead of the more common infix notation. Basically, you first specify what you want to do (the operator) and then what you want to do it to (the operands). You must separate operators and operands with spaces.
Examples: To compute 2+2: eval + 2 2To compute 5-3: eval - 5 3To compute 2+(5*6): eval + 2 * 5 6To decrease the number of screenblocks: eval - $screenblocks 1 screenblocksThe supported operators are: + a b Adds a and b. - a b Subtracts b from a.
- a b Multiplies a and b.
/ a b Divides a by b. % a b Calculates the remainder of a/b. ^ a b Raises a to the b-th power . < a b Produces 1 if a is less than b and 0 if not. <= a b Produces 1 if a is less than or equal to b and 0 if not. > a b Produces 1 if a is greater than b and 0 if not. >= a b Produces 1 if a is greater than or equal to b and 0 if not. = a b Produces 1 if a is equal to b and 0 if not. == a b Produces 1 if a is equal to b and 0 if not. != a b Produces 1 if a is not equal to b and 0 if it is. <> a b Produces 1 if a is not equal to b and 0 if is. xor a b Calculates the bit-wise exclusive-or of a and b. & a b Calculates the bit-wise and of a and b. | a b Calculates the bit-wise or of a and b. && a b Calculates the logical and of a and b. || a b Calculates the logical or of a and b.
exec (script-file)
Executes a series of commands stored in the script-file as if they had been typed in at the console directly.
key value1 [value2]
Translates all parameters to the command into their corresponding key values which are used internally for command and alias lookup. Probably not very useful for the average user.
puke (script [arguments])
Executes an ACS script on the current map, optionally passing it up to three numerical arguments.
pullin (wadfile)
Loads a wadfile at startup. This command is only valid inside .cfg files that have been execed at startup.
set (cvar) (value)
Sets cvar to value. If cvar does not exist, it will be created.
rebind (binding)
Changes the binding for the key that caused the rebind command to execute. For obvious reasons, this command cannot be used at the console.
Example:
bind b "echo setting 1; rebind \"echo setting 2\""
This will cause the first press of b to echo "setting 1" to the console. All future presses of b will echo "setting 2" instead.
unbind (key)
Removes a binding from the specified key.
unbindall
Removes all bindings and doublebindings from every key. To restore the default bindings, you can use the binddefaults command. There is no way to restore any custom bindings after issuing this command except by retyping each bind command or using the controls setup menu.
undoublebind (key)
Removes a doublebinding from the specified key.
unset (cvar)
Undefines a user-created cvar.