Console/Commands

From SRB2 Wiki
Jump to navigation Jump to search
This article or section is outdated and has not been fully updated to reflect the current version of SRB2.

Please help the Wiki by correcting or removing any misinformation, as well as adding any new information to the page.

The following is a list of console commands available in SRB2. Commands will perform a specific action instantly after being entered. These are generally one-time actions that have no lasting effects beyond the current SRB2 session, such as chat messages, netgame actions such as kicking/banning people, or game-modifying actions such as cheats or adding WAD or PK3 files to the game – the exception to this is setcontrol, a special command used to configure the player's controls, which are saved in config.cfg.

Some commands may accept one or several parameters; others have no parameters and are executed on their own. In the list below, mandatory parameters are listed in angle brackets after the command name, e.g., alias <name> <command>. Optional parameters are enclosed in square brackets, e.g., bind [<key>] [<command>].

Some console commands that pertain to the player have a second version for player 2 in splitscreen mode. In these cases, both commands are listed together, e.g., setcontrol/setcontrol2, where setcontrol is for player 1 and setcontrol2 is for player 2.

Utility commands

alias <name> <command>

Creates an alias for another console command or a sequence of commands. For instance, alias sonic "skin sonic; color blue" would create a new console command sonic that turns the player into a blue Sonic. This command is especially useful in scripts to create a shorthand for a sequence of commands that is used multiple times.

Note that alias commands are not saved when the game is closed. To create a permanent alias, put it in the autoexec.cfg file.

bind [<key>] [<command>]

Associates a certain key with a console command (or a sequence of commands) so that the command is executed when the key is pressed. Special key names are accepted by this command for binding to keys that do not correspond to printable characters. For instance, bind \ screenshot would cause a screenshot to be taken every time the \ key is pressed. If no command is given, any existing bind for the key is removed, e.g., if bind \ screenshot was executed previously, bind \ would remove the screenshot bind for the \ key. If no key or command is given, bind will instead display all existing binds set in the current SRB2 session.

Note that binds are not saved when the game is closed. To bind a key to a command permanently, put the associated bind command in the autoexec.cfg file.

cls

Clears the console buffer.

help [<command/variable>]

If used without an argument, displays a list of console commands and variables (some variables will not be displayed, such as a few cheats). If provided with the name of a command/variable, detailed info for that command/variable will be provided, if available. For variables, it also displays a list of possible values, the current value and the variable's flags.

Flag name Meaning
AUTOSAVE Saves to config.cfg when changed
FLOAT Takes floating-point values (i.e. non-whole numbers)
NETVAR Synchronized for everyone in netgames
ACTION Calls a function when changed
CHEAT Variable is a cheat, and can be reset to its default value by using cheats off

toggle <variable>

Toggles the value of the given console variable. This only works with variables that take boolean values (i.e. yes/no or on/off).

wait [<tics>]

Waits for the specified number of game tics before executing the next console command. One second consists of 35 tics. If no number is specified, a one tic delay is used by default. There is generally no reason to use this directly, but it is useful to create delays in scripts.

File management

These commands are used to load and/or save files for the game.

Further information for file-loading commands:

  • If the file has a space in its name, it must be given in quotes (e.g. addfile "test space.wad").
  • The file name can optionally be entered using the DOS 8.3 naming convention.

addfile <filename>

Requirements: If in multiplayer, server or admins only, unless the file contains only music and sound effects

Adds a WAD, PK3, SOC, or Lua script to the game. The file extension must be specified, e.g., addfile test.wad instead of addfile test. After adding a file, the game will immediately be marked as modified, unless it is a WAD that contains only music and sound effects.

changeconfig <filename>

Saves the current configuration file and loads the specified one. The file name is required to end with .cfg – if the file extension is not specified or is not the correct one, the game will automatically modify the file name given to end with .cfg anyway.

exec <filename> [-noerror] [-silent]

Executes the specified console script. The file extension must be specified. The parameter -noerror suppresses the error message if the script cannot be executed, while -silent suppresses the return message if the script is successfully executed. Both parameters cannot be used at the same time.

loadconfig <filename>

Loads the specified configuration file without saving the current one. The file name is required to end with .cfg – if the file extension is not specified or is not the correct one, the game will automatically modify the file name given to end with .cfg anyway.

runsoc <filename or lumpname>

Requirements: If in multiplayer, server or admins only

Loads the specified SOC. This can be either a stand-alone file (requires the file name to end with .soc, which must be specified) or a lump in one of the currently loaded WAD or PK3 files.

saveconfig <filename> [-silent]

Saves the current configuration under the specified file name. -silent suppresses the return message if the configuration is successfully saved. The file name is required to end with .cfg – if the file extension is not specified or is not the correct one, the game will automatically modify the file name to end with .cfg anyway.

General game commands

displayplayer

Shows the number of the player who is currently being displayed.

exitgame

Exits the current game and returns to the title screen.

gametype

Shows the current gametype as one of the following numbers:

Number Game type
0 Single Player/Co-op
1 Competition
2 Race
3 Match
4 Team Match
5 Tag
6 Hide and Seek
7 Capture the Flag

map map<value>

Changes the level. For instance, to warp to Greenflower Zone Act 1, type map 1. You can also type the zone's abbrevation, such as map gfz1. For the map numbers of official SRB2 maps, consult the list of levels. If you want to know the map number of a custom map, open the file containing the map in a lump editor and look for the SOC lump containing the level header (which is often the MAINCFG lump). In that lump, search for the map name and look at its corresponding map number.

The map command takes two (or three, if devmode is enabled) optional parameters:

-g <gametype name or number>

Requirements: Multiplayer only

Specifies the gametype to play the new map in, e.g., map map01 -gametype Tag. Alternatively, you can specify the gametype's number instead of its name, e.g., map map01 -gametype 3. See below for the numbers and names associated with each gametype:

Number Gametype
0 "Co-op"
1 "Competition"
2 "Race"
3 "Match"
4 "Team Match"
5 "Tag"
6 "Hide and Seek"
7 "CTF"

-f

Forces the game to warp to the map even if it does not support the current gametype, e.g., map map01 -f when not in Single Player, Co-op, Competition or Race mode. To always force the map warp without having to explicitly enter -force every time, use skipmapcheck.

-noresetplayers

Requirements: devmode enabled

Makes the game warp to the map without resetting player data like lives, score, etc.; as if the player had advanced to the map normally.

manual

Shortcut: F1 key

Opens the game's manual.

pause [<0/1>]

Requirements: If in multiplayer, server or admins only, unless pausepermission all is set
Shortcut: Pause control (default key is Pause/Break)

Pauses the game. Reuse it to unpause. If a number is given, the game will pause if 1 is supplied or unpause if 0 is supplied, but not vice versa.

playintro

Requirements: Not in a game

Replays the opening intro.

quit

Exits the game immediately, skipping all menus and displays.

resetcamera

Resets the camera's position and properties. The player's "reset camera" key has the same function as this.

retry

Requirements: Single Player only

Retries the current level from the last Star Post. The player needs to have at least one life left to do this, and one life will be subtracted from their count.

setcontrol/setcontrol2 <control name> <key name> [<second key name>]

Manually changes the controls of player 1 or player 2. Note that both the control name and key name need to be enclosed in quotation marks. You can additionally set a secondary key for the selected control by adding it after the first, with the same format as the first key name. See config.cfg for examples of how this command is used, and Controls > Configurable controls for the full list of control names.

Many keys expect certain key name strings – see Special key names for the full list of these.

showmap

Shows the map number and the name (excluding "Zone" and "Act") of the map currently being played.

Development tools/Game cheats

These commands are either game cheats or internal testing tools. All of them will mark the game as modified, and most require development mode to be activated, so devmode should be set before using them.

charability <1/2> <value>

Requirements: devmode enabled

Changes the character ability of the player. charability 1 changes the player's primary ability, and charability 2 changes the player's secondary ability. See the tables below for the ability options for both:

charability 1
Value Ability
0 None
1 Thok
2 Fly
3 Glide/Climb
4 Homing attack
5 Swim
6 Double jump
7 Float
8 Slow fall
9 Telekinesis
10 Fall switch
11 Jump boost
12 Air drill
13 Jump-thok
14 Bounce
15 Twinspin
16 and above None
charability 2
Value Ability
0 None
1 Spindash
2 Gunslinger
3 Melee
4 and above None

See S_SKIN > ability and S_SKIN > ability2 for detailed descriptions of these abilities.

charspeed <parameter> <value>

Requirements: devmode enabled

Changes one of the character speeds of the player. Possible parameters are normalspeed, runspeed, thrustfactor, accelstart, acceleration and actionspd. Note that this command accepts values that would not normally be possible to set in a character's S_SKIN, including negative values.

devmode <integer>

Requirements: Single Player only

Activates development mode and sets its flags. See development mode for deeper info.

exitlevel

Requirements: devmode enabled, or server or admin in multiplayer

Finishes the current level and warps to the next one (after the score tally/intermission screen).

getallemeralds

Requirements: devmode enabled or Pandora's Box unlocked

Gives the player all 7 Chaos Emeralds.

god

Requirements: Single Player only

Makes the player invincible to everything, including instant kill hazards. Use the command again to make the player vulnerable again.

gravflip

Requirements: devmode enabled

Flips the direction of gravity.

hurtme <value>

Requirements: devmode enabled

Hurts the player. The only value with special significance is 10000, which will instantly kill the player.

jumptoaxis <axis number>

Requirements: devmode enabled

In NiGHTS, this teleports the player to the specified Axis.

noclip

Requirements: Single Player only

Turns off the player's collision, allowing them to walk through walls. Deaths by crushing are also prevented, but all other types of damage are still in effect. Use the command again to re-enable collision.

notarget

Requirements: Single Player only

Prevents any enemies that have not already targeted the player from doing so, allowing the player to freely move around the enemies without being attacked by them. Use the command again to re-enable targeting.

objectplace [-silent]

Requirements: Single Player only

Activates Object placement mode. Use the command again to deactivate it. The parameter -silent suppresses the on-screen text explaining the controls.

resetemeralds

Requirements: devmode enabled or Pandora's Box unlocked

Removes all Chaos Emeralds from the player's possession.

rteleport [-x <X distance>] [-y <Y distance>] [-z <Z distance>]

Requirements: devmode enabled

Teleports the player relative to their current location. The distance is specified in fracunits. Cannot be used to teleport outside the map or into a space the player cannot fit inside.

savecheckpoint

Requirements: devmode enabled

Creates a temporary and invisible Star Post at the player's current location. The Star Post disappears once the player exits the map or activates another Star Post.

scale <decimal>

Requirements: devmode enabled

Scales the player to a fraction of their original size – 1 is normal size, 0.5 is half the normal size, 2 is twice the normal size, and so forth.

setcontinues <integer>

Requirements: devmode enabled or Pandora's Box unlocked

Sets the number of continues the player has.

setlives <integer>

Requirements: devmode enabled or Pandora's Box unlocked

Sets the number of lives the player has.

setrings <integer>

Requirements: devmode enabled or Pandora's Box unlocked

Sets the number of rings the player is carrying.

skynum <number>

Requirements: devmode enabled

Changes the sky. Refer to Flats and textures/Skies for a list of skies with samples and slot numbers.

teleport -x <X location> -y <Y location> [-z <Z location>]

Requirements: devmode enabled

Teleports the player directly to the coordinates specified. If no Z coordinate is given, the destination sector's floor height is used. Cannot be used to teleport outside the map or into a space the player cannot fit inside.

weather <number>

Requirements: devmode enabled

Changes the weather. Refer to Level header > Weather for a list of weather types with slot numbers.

toggletwod

Requirements: devmode enabled

Toggles between 2D mode and 3D mode. Note that this won't have any effect if the level header is set to use 2D mode.

Server/admin commands

ban <playername/node> [<reason>]

Requirements: Multiplayer, server or admins only

Kicks and bans the specified player from a netgame. Optionally, a reason can be supplied as a second parameter which will be displayed to the player. Once a player is banned, they can no longer join the server unless clearbans is used. Banned players are listed in the file ban.txt. The maximum amount of bans is 100. If the command is used when ban list is full, the player will only be kicked without the ban being registered.

banip <ip address> [<reason>]

Requirements: Multiplayer, server only

Bans an IP address from the netgame. This works even if there are no players with the IP address currently in the netgame. Optionally, a reason can be supplied as a second parameter which will be displayed to players with the IP address. Once an IP address is banned, players with the IP address can no longer join the server unless clearbans is used. Banned IP addresses are listed in the file ban.txt. The maximum amount of bans is 100.

clearbans

Clears all bans. Users that were banned will be able to join again.

clearscores

Requirements: If in multiplayer, server or admins only

Resets all players' scores to 0. This also works in Single Player games.

csay <message>

Requirements: Multiplayer, server or admins only

Sends a message to everyone within a netgame which is displayed in the center of the screen. Backslashes indicate line breaks.

demote <node>

Requirements: Server only

Removes administrative privileges from a player in a netgame.

kick <playername/node> [<reason>]

Requirements: Multiplayer, server or admins only

Kicks the specified player out of a netgame. Optionally, a reason can be supplied as a second parameter which will be displayed to the player.

motd <message>

Requirements: Multiplayer, server or admins only

Sets a "Message of the day" that is displayed in a player's chat log when they join your server. Note that semicolons (;) are not allowed in the message, and will be removed if found. Due to a glitch, sometimes trying to change the message after it was already set will instead cause the new message to be appended to the end of the previous one.

password <value>

Requirements: Server only

Changes the server password to the given value.

promote <node>

Requirements: Server only

Gives a player administrative privileges in a netgame.

reloadbans

Reloads an existing ban.txt and bans all of the included IP addresses.

serverchangeteam <playername/node> <red/blue/spectator/playing/it/notit>

Requirements: Multiplayer, in a gametype with teams or spectators, server or admins only

Changes the team the specified player is on. Can also be used to force a player to spectate, or to bring them into the game from spectating. In Tag/Hide & Seek, you can use this to make players "it" or not "it" (at least one player must be "it"), but you can no longer do so once the hidetime has run out.

Team
(integer)
Team
(string)
Tag/Hide & Seek
0 "spectator"
1 "it"
2 "notit"
3 "playing"
CTF/Team Match
0 "spectator"
1 "red"
2 "blue"
Other gametypes with spectators
0 "spectator"
1 "playing"

showbanlist

Lists all bans made in-game and in ban.txt along with the ban reasons.

masterserver_update

Force the Master Server listing of a server to be updated.

Client commands

changeteam/changeteam2 <red/blue/spectator/playing>

Requirements: Multiplayer, in a gametype with teams or spectators

Changes the team you are currently playing for. You can also use this command to become a spectator, clearing your score and turning you into an invisible bystander, or to enter the game after spectating. Does not work in Co-op, Race or Competition.

Team
(integer)
Team
(string)
CTF/Team Match
0 "spectator"
1 "red"
2 "blue"
Other gametypes with spectators
0 "spectator"
1 "playing"

connect <parameters>

Requirements: Not in a game

Used to connect to a server, depending on the parameters used:

Usage Effect
connect <ip>[:<port>] Connects to the specified IP address. Optionally, the port to use can be specified as well, in the format connect <ip>:<port>. If no port is specified, the standard port is used, which is 5029.
connect <ip> <port> Same as using connect <ip>:<port> as above, for connecting to a specific port.
connect self Connects to the local user's own server. Note: Due to a bug, this causes the game to freeze.
connect any Searches for a server via LAN and connects to the first server found.
connect node <servernum> Used internally by the "Join Game (Search)" menu, to pick the specified server from a list of servers displayed for a room.

listserv

Retrieves and displays a list of hosted games from the Master Server.

login <password>

Attempts to log in as a netgame administrator. The password is set by the host.

Miscellaneous netgame/multiplayer commands

cheats [<off>]

Requirements: If using cheats off, server or admins only

When used without a parameter, states whether any cheat-marked variables have been modified. Entering cheats off will revert all cheat-marked variables to their default values.

getplayernum

Lists all of the players in the game, their player numbers, and their node numbers.

nodes

Lists all of the players in the game and their node numbers.

ping

Lists the ping for all other players, i.e., the time it takes to send a packet from the server to the player and back.

say <message>

Sends a chat message to all players.

sayteam <message>

Sends a chat message to your team. Only meant to be used in team-based gametypes like Team Match, Tag, Hide & Seek, or CTF. The host of a dedicated server cannot use this, since they are not playing themselves and therefore do not belong to any team.

sayto <playername/node> <message>

Sends a chat message to a specific player. If the player has special characters in their name, such as spaces or parentheses, the player name must be enclosed in quotes. Alternatively, the player's node number can be used.

showscores

Requirements: Multiplayer only

Shows the game scores of all players. Also displays the point limit of the game.

showtime

Requirements: Multiplayer only

Shows the time and, if applicable, the time limit of the current game.

suicide

Requirements: Multiplayer, Co-op/Competition/Race only

Kills the player and subtracts one life. Useful if you've become stuck in an area you can't escape from.

Video

vid_info

Displays information about the current engine mode and video mode.

vid_mode <mode number>

Sets the video mode. To see which video mode corresponds to which number, use vid_modelist.

vid_modelist

Lists all available video modes along with their screen resolutions and their corresponding mode numbers.

vid_numnodes

Shows the number of available video modes.

Technical information

countmobjs [<type>]

Counts all Objects of the specified Object type in the level and displays the total in the console. The Object type must be specified as a number; consult List of Object types for the numbers corresponding to the Object types. If no Object type is specified, the total number of Objects is listed for each Object type present in the map. Precipitation Objects such as rain or snow will not be counted.

gr_stats

Requirements: Using the OpenGL renderer

Displays OpenGL-specific memory usage statistics.

isgamemodified

Checks if the game is modified and if secrets can be unlocked, and displays the result in the console.

listwad

Displays a list of WAD and PK3 files loaded in the game, in inverse order to the order in which they were loaded. The total number of files loaded is displayed at the top of the list. Files listed with file numbers colored yellow are the resource files for SRB2. "IWAD" is displayed next to the IWAD (srb2.pk3). All other resource files are listed with an asterisk (*) preceding the file number.

mapmd5

Displays the MD5 checksum of the current map.

memfree

Displays memory usage statistics.

mod_details

Lists the ID, version and codebase of the executable currently used. In SRB2 v2.2.13, this will print "Mod ID: 18", "Mod Version: 54", and "Code Base: 220".

numthinkers <type>

Counts the number of thinkers of a particular type, listed below. Useful for development and code testing.

Value Thinker name Description
1 P_MobjThinker Thinker for regular Objects
2 P_NullPrecipThinker Thinker for precipitation
3 T_Friction Thinker for friction
4 T_Pusher Thinker for pusher specials (i.e. wind/current)
5 P_RemoveThinkerDelayed Thinker for thinkers in the process of being removed

version

Displays the version of SRB2 being used, along with the date, time and revision number at which the executable was compiled, along with the interface, operating system and the processor architecture. For example, on the 32-bit version of SRB2 v2.2.0 for Windows, this will print:

Sonic Robo Blast 2 v2.2.0 (Dec  7 2019 11:46:20 69c08f93) SDL Windows 32-bit

Echo

cecho <message>

Displays the specified message in the center of the screen. Backslashes indicate line breaks.

cechoduration <seconds>

Changes the duration that a cecho message stays on screen, in seconds.

cechoflags <integer>

Sets the flags for cecho. Hexadecimal numbers are also accepted as values, provided the input is prefixed with 0x. See Video flags for the full list of flags and their values.

echo <message>

Displays the specified message in the console. Useful for scripting.

Screenshots, movies and demos

playdemo <filename>

Requirements: Not in a game

Plays back a recorded demo.

screenshot

Shortcut: F8

Takes a screenshot of the display. Note that if you type this command directly into the console, the console will appear in the screenshot. To avoid this, use the shortcut F8 or bind the command to a key.

startmovie

Shortcut: F9 (toggles)

Creates a movie of the game, which will output as a GIF, animated PNG or multiple screenshots depending on the mode set by moviemode_mode.

stopdemo

Requirements: A demo is playing

Stops the currently running demo.

stopmovie

Shortcut: F9 (toggles)

Stops recording the movie started with startmovie.

timedemo <demoname> [-csv [<trialid>]] [-quit]

Requirements: Not in a game

Plays back the specified demo at the highest possible speed and prints out information about how fast it was processed in the console afterwards. Useful for benchmarking. When -csv is specified, it will write a row to "timedemo.csv", beginning with <trialid> to identify the row. Specifying -quit will immediately quit the program after timedemo, which is useful for tool automation.

Sound

restartaudio

Restarts the game's audio playback system. If you changed your audio output device mid-game, use this command to make the game switch to the new device.

tunes <name/number> [<track>] [<speed>] / <-show/-default/-none>

Changes the music currently playing. You can either supply the name of a music track (e.g. mapb0m) or a slot number (e.g. b0). Both integers and extended map numbers are accepted as slot numbers. If the music format supports multiple tracks, you can supply the track number as well. For music tracks in a format supported by the Game Music Emu library, you can optionally supply the playback speed as a positive decimal number (i.e.: 0.5, 0.22, 1.3); 1.0 is the default speed. Note that changing the playback speed also affects the pitch of the music.

Instead of a track name or slot number, there are three special parameters you can use: -show will display the currently playing tune and track on the console. -default will reset the music to the default music for the map. -none will stop the music playback.