Console/Commands

From SRB2 Wiki
Jump to: navigation, search

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 files to the game – the exception to this is setcontrol, a special command used to configure the player's controls that is 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, 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.

Contents

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.

english

Sets the game's current keymap to the English keymap. (This is redundant, as no other keymaps currently exist in SRB2.)

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. 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, 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 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 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 map01. 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 WAD 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. If it consists of two digits xx, type map mapxx to switch to the map. If it consists of more than two digits, it is an extended map number; consult the list of extended map numbers to convert it to a two-digit number.

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

-gametype <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"

-force

Forces the game to warp to the map even if it does not support the current gametype, e.g., map map01 -force 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.

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 and above None
charability 2
Value Ability
0 None
1 Spindash
2 Multi-ability
3 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

Requirements: Single Player only

Activates Object placement mode. Use the command again to deactivate it.

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.

writethings

Requirements: objectplace enabled

This saves a list of all Things in the map, including the ones that have been placed in Object placement mode, in your SRB2 folder under the name NEWTHINGS.lmp. Replace the THINGS lump for the current map with this file to permanently save the additions you made in Object placement mode. Note that zones.dta may not be modified, so to add Things to an official map, you have to make a copy of the map in question.

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.

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.

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.

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.

verify <playername/node>

Requirements: Server only

Gives a player administrative privileges in a netgame. Only one player may be verified at a time.

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

Requirements: srb2win.exe executable used

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_modeinfo [<mode number>]

Requirements: srb2dd.exe executable used

Displays information about the specified video mode, or the current video mode if used without a parameter.

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 files loaded in the game, in inverse order to the order in which they were loaded. The total number of WAD files loaded is displayed at the top of the list. WADs listed with file numbers colored yellow are the resource files for SRB2. "IWAD" is displayed next to the IWAD (srb2.srb). 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.1.19, this will print "Mod ID: 12", "Mod Version: 24", and "Code Base: 210".

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_RainThinker Thinker for rain
3 P_SnowThinker Thinker for snow
4 P_NullPrecipThinker Thinker for "blank" precipitation
5 T_Friction Thinker for friction
6 T_Pusher Thinker for pusher specials (i.e. wind/current)
7 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. In SRB2 v2.1.19, this will print "Sonic Robo Blast 2 v2.1.19 (May 28 2017 12:27:09 22232832)".

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 <filename>

Requirements: Not in a game

Plays back the specified demo at the highest possible speed. Useful for benchmarking.

Sound

cd <action>

Requirements: The command line parameter -usecd is set, srb2dd.exe executable used

Performs one of the following actions relating to a music CD:

Parameter Effect
on Enables playback from a music CD.
off Disables playback from a music CD.
remap <integers> Remaps the tracks on the current music CD in a different order. The order is set by the additional parameters you supply: If the n-th parameter is x, track n will be mapped to track x, i.e., if you enter cd play n in the console afterwards, track x will be played. You can supply fewer parameters than there are tracks on the CD; in this case, any tracks for which no parameter is supplied will retain their previous mapping. For example, cd remap 3 1 1 will remap track 1 to track 3 and both track 2 and track 3 to track 1. All tracks from track 4 onwards will stay unchanged.

Note that due to a bug, all track numbers in the remapping are off by one. For example, mapping track 1 to track 3 will actually map track 2 to track 4. Due to this, it is impossible to remap track 1.

remap Prints the current remapping of the tracks in the console.
reset Resets the CD driver and the track mapping.
info If a music CD is found, lists its tracks and their running times, as well as the total running time. If a track is currently playing, names that track.
play <track> If playback is enabled, plays the specified track from the music CD.
loop <track> If playback is enabled, plays the specified track from the music CD in a loop.
stop If a track is currently playing, interrupts the playback.
resume If playback of a track has been interrupted, resumes it.

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. As an optional parameter, you can 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. This feature is supported only by srb2dd.exe; in the main EXE (srb2win.exe) this parameter does not affect the music playback at all.

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.