Console

From SRB2 Wiki
Jump to: navigation, search
Test.png This article or section is incomplete. It doesn't have all of the necessary core information on this topic. Please help the SRB2 Wiki by finishing this article.
Console showing a list of commands and variables after using the HELP command.

In SRB2, the console is an internal command prompt that allows the user to control many of the game's options and to perform certain actions. Sometimes the same effects can be achieved using the menus, but the console is often the only way of utilizing many features. The console also functions as a log that lists some of the previous game events and messages along with the commands that have been activated in it – after the game has closed, the full console output for the last SRB2 session can be viewed through the log.txt file.

The console is accessed by pressing the Console key defined in the controls, which by default is ~ (tilde) on US keyboards and ` (backquote) on UK keyboards. This displays a prompt at which the user is expected to enter a command. To close the console, press the same key that was used to open it.

The console will not be accessible to the user when in Record Attack/NiGHTS Mode, or when a Metal Sonic replay is being recorded.

Controls

The controls for handling the console when active are listed below:

General
Escape Closes the console, if open. Note that in most situations, this will simply bring up the main menu or the respective pause menu if in-game, immediately closing the console.
Left Arrow/
Right Arrow
Moves the input cursor left/right. If Shift is held down at the same time, the cursor can be used to select text in the input (the selected text is highlighted yellow).
Home Immediately moves the input cursor to the beginning of the input line. If Shift is held down at the same time, this causes all input text before the cursor's old position to be selected (the selected text is highlighted yellow).
End Immediately moves the input cursor to the end of the input line. If Shift is held down at the same time, this causes all input text after the cursor's old position to be selected (the selected text is highlighted yellow).
Enter Executes the text in the input.
Backspace Deletes the character behind the input cursor. If any text is selected in the input, the selected text is deleted instead.
Delete Deletes the character in front of the input cursor. If any text is selected in the input, the selected text is deleted instead.
Text selection
Ctrl + X Cuts selected text from the input line to the clipboard.
Ctrl + C Copies selected text from the input line to the clipboard.
Ctrl + V Pastes the last cut/copied text to the input line from the clipboard.
Ctrl + A Selects all text in the input line.
Input/output history
Up Arrow/
Down Arrow
Moves back/forward through the console's input history, i.e. the text that the user has typed into the console and executed during the SRB2 session.
Page Up/
Page Down
Scrolls up/down through the console's output history, i.e. the text that has been printed out by the console during the SRB2 session.
Shift + Home Immediately scrolls to the oldest output text in the console.
Shift + End Immediately scrolls to the most recent output text in the console.
Auto-complete
Tab Auto-completes a partially entered console command/variable name, if this had not been done already. Pressing this key again will display the next possible command/variable in the full list of possible options.
Note: this list goes through all possible commands alphabetically first, followed by all possible variables alphabetically.
Shift + Tab Auto-completes a partially entered console command/variable name, if this had not been done already. Pressing this key again will display the previous possible command/variable in the full list of possible options.
Ctrl + Tab Lists all possible console commands/variables that match the partially entered text in the console, separating the commands and variables into their own lists.

Console messages

There are several special types of messages that can appear in the console during an SRB2 session:

Chat messages

These are messages that have been sent by a player through the Talk or Team Talk keys (or the commands SAY, SAYTEAM and SAYTO). These will display the name of the player who sent it, and will always be accompanied by a "beep" sound that plays whenever they first appear.

The "/me" command can be used at the start of a chat message for typing out actions written in the third person; when these messages appear, they will be colored yellow in the chat log and console.

Alerts

Alert messages appear with a colored prefix when printed in the console; there are three types of alert messages in SRB2:

Alert type Description
Notice Low-importance alert; e.g. incorrect input
Warning Medium-importance alert; e.g. minor issue in WAD detected on load
Error High-importance alert; e.g. maximum WAD files reached; WAD file not found

Debug

These are special messages that appear only when specific modes in development mode have been turned on.

Commands and variables

Commands and variables are an important feature of the console – these allow the user to change various kinds of settings in the game by simply typing them into the console and pressing Enter to excecute them. Alternatively, these can be executed through console scripts or the command line; see the sections below for more details. These two groups of options differ in particular ways:

  • Commands will all perform a specific action instantly after being executed. These generally control features of the game that will not affect the next 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 console command used to configure the player's controls that is saved in config.cfg. Many commands do not require parameters at all, and are therefore given on their own; others may accept any number of parameters depending on the command being used.
  • Variables are unlike commands in that instead of directly performing an action, values for them can be changed which in turn can make a difference to the game. These will all take only a single parameter of a specific type – this can be a boolean, integer, decimal number, a string, depending on what is required. Some variables may only allow the user to select specific values from a list, or any in a range of values. A large portion of variables are saved in config.cfg, allowing them to be carried over to the next SRB2 session even after closing the game. Note that most console variables also have equivalents in the game's Options menus.

Commands and variable names themselves are not case-sensitive; for easy reference, they will usually be given as all-uppercase in all articles that refer to them on the SRB2 Wiki.

Special characters

Certain characters are used in the console and console scripts with commands and variables for special purposes.

Semicolon (;)

The semicolon character (;) is used to separate commands or variables from each other, if multiple are to be executed on the same line. For example, COLOR PURPLE; SKIN KNUCKLES will change the player's color to purple, then change the player's skin to Knuckles.

Quotation mark (")

The quotation mark character (") can be used to enclose parameters for commands and variables that require a string, though they are not required unless the string contains a space or any of the following characters within (separated by spaces):

{ } ( ) ' :

This is useful for instances where a command/variable with parameters is itself being executed (or stored to be executed later) within a parameter for another, e.g. BIND 1 "SAY HI" would bind "SAY HI" to a key – in contrast, BIND 1 SAY HI would not work as "SAY" and "HI" are now treated as two separate parameters.

Another example of a case where quotation marks would be necessary is if one wanted use the CONNECT command to connect to a server using a specific (non-default) port: using CONNECT "192.168.1.5:5028" would work, but CONNECT 192.168.1.5:5028 would not work as the : (colon) character is present.

Console scripts

Main article: Console script

A console script is a text file that can be used to input commands and variables into the console without having to type them every time. You can make one by creating a new text file and inputting commands in it. While it is not required, command/variable names and parameters are usually written in all-lowercase for readability (except for button names like KEY93). They can be separated either by lines or by semicolons.

Example of tunebinds.txt:

bind 1 "tunes 45"
bind 2 "tunes 29"
bind 3 "tunes 93"
bind 4 "tunes 102"

To use a script file, just type EXEC <script filename> in the console. For the above example, typing EXEC TUNEBINDS.TXT would work.

autoexec.cfg

autoexec.cfg is a special script file that will be loaded automatically on startup. It does not exist by default; you have to create it yourself (for example with Notepad) and put it in SRB2 directory. This can allow for a default name, color, and skin for netgames, as well as other things such as binds and aliases.

adedserv.cfg

adedserv.cfg is a special script file that is loaded ran when starting a dedicated server. Like autoexec.cfg, it runs commands such as BIND and ALIAS.

Command line

See also: Command line parameters

All console commands and variables can also be executed when the game is launched, by either using the SRB2 Launcher's command line, by use of the Windows Command Prompt, or by the execution of a batch file, e.g. skinandcolor.bat, whose text could be srb2win.exe +skin sonic +color blue.

The syntax is the same as would be done in the console itself, except prefixed with a plus sign (+) as in +map map01 or +skin sonic. However, this will not work for any console command/variable parameters starting with a minus sign (-), e.g -force for the MAP command – the game will assume it is one of the non-console command line parameters, so they will not be run in the console with the rest of the command/variable.

See also