Console script

From SRB2 Wiki
(Redirected from Autoexec.cfg)
Jump to: navigation, search

A console script is a plain text file with an ordered list of console commands that SRB2 can execute. For example, consider the following script:

alias camoff "chasecam 0; crosshair 1; alwaysmlook 1;"
alias camon "chasecam 1; crosshair 0; alwaysmlook 0;"
bind z camoff
bind x camon
bind c screenshot
name sonic
skin sonic
color blue

The alias commands make new console commands by combining existing ones. These two turn the camera on and off while also toggling the crosshair (not needed in a chasecam toggle) and the mouse look.

The bind commands bind a key to a console command. The Z key will turn off the camera, the X key will turn it back on, and the C key will take a screenshot.

The last three lines will change name, color, and skin. This doesn't do much in single player, but if one is playing multiplayer, it would quickly set his name, skin, and color, which can be helpful considering SRB2 doesn't have a way to set a default name.

While all of the above could be done in the console manually, scripts are useful because all one has to do is type exec <filename> into the console. Since commonly used commands and binds are added all at once upon executing a script, it is an efficient way to save time.

Special console scripts

autoexec.cfg

autoexec.cfg is an external script file that runs upon loading SRB2. It should placed in the SRB2 directory with the filename of autoexec.cfg in order for it to work. To create it, use Notepad and remember to save it with the .cfg extension.

autoexec.cfg is especially useful for creating recurring binds and changing one's name and color on startup. It can be used for a lot of things, however, one must remember that if it is placed in the SRB2 directory, it will reactivate every time SRB2 is run. If it contains commands that modify the game (such as addfile), the user will not be able to join netgames without the added files until these commands are removed.

adedserv.cfg

adedserv.cfg is an external script file that runs upon loading SRB2. This is identical to autoexec.cfg in function, but will be loaded only if a dedicated server is being set up.