Command Line - tModLoader/tModLoader GitHub Wiki
In addition to all the Command Line and Server Config settings available in vanilla Terraria, tModLoader adds a few listed below.
TOBEADDEDLIST
- -loadlib
- -publish, -ciprep, -publishedmodfiles, -uploadfolder
- -experimental
- XNA-FNA Args like /gldevice:OpenGL
- -steamworkshopfolder
- -audiodriver -> Overrides SDL_AUDIODRIVER
- -videodriver -> Overrides SDL_VIDEODRIVER
savedirectory [pathToSaveDirectoryFolder]
Server and Client Command Line Argument
Specifies the save directory. The default save directories are listed here but without the final folder in the path. The directory /tModLoader
(or either /ModLoader
or /tModLoader-1.4.3
if on 1.3 or 1.4.3 tModLoader instead) will automatically be appended to the provided path. Use this argument to specify a different save directory. The save directory is the parent directory of the worlds directory and mods directory, so you can use only this parameter rather than both of those.
tmlsavedirectory [pathToSaveDirectoryFolder]
Server and Client Command Line Argument
Same as savedirectory
above except /tModLoader
won't automatically be appended to the provided path.
modpack [modpackname]
Server and Client Command Line Argument, Server Config.
Specifies a modpack to use by name. Omit the .json
extension. The mods specified in the modpack (and only them) will be loaded. Useful for quickly launching a specified set of mods for people who might be doing multiple concurrent play-throughs with different sets of mods.
modpath [pathToModsFolder]
Server Command Line Argument, Server Config.
Specifies the folder to look for .tmod
files. Useful for hosted servers as typically the default folder location is no accessible on dedicated hosts.
skipselect
Server and Client Command Line Argument
Useful for modders who wish to quickly test their mod. This flag will automatically select the 1st player and world in the list, allowing the modder to launch directly into the game. Very useful when building and launching from Visual Studio.
Modders should read the Using Command Line Arguments for Debugging section below to learn how to easily use this argument while debugging.
If you wish to specify a specific player and world, you can use -skipselect "MyPlayer:MyWorld"
. Either can be omitted and will default to the first player or world if missing. For example, -skipselect ":MyWorld"
will select the 1st player and the specified world. These parameters go off of the world name (what you see in game), not the file path.
For servers, the -world
argument available in vanilla Terraria is similar. It uses the world file path as the argument instead of the world name.
build [pathToModSource]
Server Client Command Line Argument
Builds the mod specified by the folder from source, useful for modders. Used by default by the autogenerated csproj.
eac
Server Client Command Line Argument (Windows Only)
Enables Edit and Continue, useful for modders. Used by default by the autogenerated csproj.
Usage
For dedicated server configs, follow the example shown in the serverconfig.txt
file in the tModLoader install directory. (for example, "modpath=/mymods/". Basically, [settingname]=[settingvalue])
Otherwise, use either a script (.bat
on windows, .sh
on linux/mac) to specify a command line argument. (for example "Terraria.exe -modpack friendsplaythrough") Windows users can also add parameters to shortcut files by adding to the end of "Target".
Examples
Windows Shortcut
Make a shortcut to the tModLoader exe file by either copy and then paste shortcut or by right click dragging the file to another place and selecting "create shortcuts here". Next, right click properties and edit the Target appropriately.
Launch Windows Client with a specific Mod Pack
See picture:
Dedicated Host
A Dedicated Host is a company that provides server hosting for a fee.
Edit the server config file that the dedicated host is using. Not every host is the same. You'll need to make sure that tModLoaderServer is being launched with either the command line argument or the server config line for the path to Mods folder. If you wish to use a Mods folder in the same folder as the tModLoaderServer executable, I believe you can use a relative path like "modpath=./Mods". You'll also need to set savedirectory since some mods store mod specific data in the save directory. (savedirectory is a command line only parameter.) Add -savedirectory ./
to the command that launches the server, which can be found usually on the website for your host.
Dedicated Hosts known to work
NodeCraft - Follow the instructions
GameServers - Add -savedirectory ./
to server command line
Akliz Hosting - Works as is.
Citadel Servers Hosting Company
Dedicated Server (Self-Hosted)
If you have an extra computer around, you can use it to host a server 24/7 without paying for a Dedicated Host. Setting up a dedicated server involves installing the tModLoader files and configuring the computer to run the server forever (execute the tModLoaderServer script (Linux/Mac) or tModLoader.exe (Windows)).
Linux
If you'd like to install tModLoader on a Linux computer you have access to, but isn't the computer you intend to play on, below is a script that will setup tModLoader without needing Steam or Terraria installed. Make a linuxServerScript.sh
file with the contents below in a folder where you wish to install the tModLoader server. chmod +x linuxServerScript.sh
the file so you can execute it, then run it. This script downloads the latest tModLoader and does the extracting of the files for you. After installation, it is up to you to manage running the server whenever you want by running ./tModLoaderServer
manually or with a script. You might want to use -config serverconfig.txt
or the -tmlsavedirectory
options to configure the behavior of the server as usual.
# Linux Server Install Script v1.1 by Chicken-Bones (some changes by jopojelly)
wget https://api.github.com/repos/tModLoader/tModLoader/releases/latest -O tMLlatest.json
tml=`sed -n 's/.*\(https.*Linux.*.tar.gz*\)".*/\1/p' tMLlatest.json`
wget $tml
tar xvzf tModLoader.Linux*.tar.gz
chmod a+x tModLoader tModLoader-* tModLoaderServer *.bin*
rm *.zip *.tar.gz *.jar tMLlatest.json
Linux Server Flags for start-tModLauncherServer.sh:
Flag | Explanation |
---|---|
-steam | Use steam server. |
-nosteam | Don't use steam. |
-config | Server will attempt to read config options from a file named "serverconfig.txt". |
-lobby | Used in combination with the -steam to specify whether the lobby is open to "friends", "friends -friendsoffriends", or its "private". |
The sample "serverconfig.txt" file contains a list of the main command-line arguments.
Using Command Line Arguments for Debugging
Adding Command Line Arguments in Visual Studio
This section assumes you have a working development setup achieved by following the Developing with Visual Studio guide.
To add arguments for debugging, open up the debug properties for your mod's project. To do this, click the small black arrow next to the Debug Target
button. The Debug Target
button has a green arrow and will likely be labeled Terraria
at this time. In the dropdown, select [ModName] Debug Properties
:
This will open up a window named Launch Profiles
. In this window find the Command line arguments
section. This is where the command line arguments that are used while debugging are assigned. The default value should be $(tMLPath)
. More arguments can be added to this entry. The most useful argument to add is -skipselect
(See the skipselect section above for more details.).
If you are debugging the server instead of the client, make sure to select the TerrariaServer
launch profile and then change Command line arguments
. The default value would be $(tMLServerPath)
for the server launch profile.
Launch Profiles
By default, your mod project will come with 2 launch profiles, Terraria
and TerrariaServer
. These will launch and debug the client and server respectively. In the previous section, we added -skipselect
to one of those default launch profiles to streamline debugging by bypassing the player and world select menus. This is useful but we might not always want that behavior and editing launch profiles to add or remove command line arguments can get tedious.
To avoid this, we can create a new launch profile with the new behavior. When we want the new behavior, we just need to select the launch profile from the dropdown and start debugging.
First, open up the Launch Profiles
menu again:
Select the launch profile you want to make a copy of (Terraria
for client or TerrariaServer
for server), then click Duplicate Selected Profile
:
Next, click Rename selected profile
and give it a suitable name. In this example we will be naming the profile TerrariaMyTestWorld
because we will be launching a world named "MyTestWorld" using the -skipselect
argument. Next, edit the Command line arguments
section and add the arguments you want. In this example, -skipselect ":MyTestWorld"
has been added.
Close the Launch Profiles
window. From now on, you can use the Debug Target
dropdown menu to select a launch profile, then click it to start debugging with that profile.
Launch profiles are stored in the Properties/launchSettings.json
file. The file can be edited manually if that is more convenient, just make sure to follow json syntax.
Launch Profiles Ideas
Using launch profiles to streamline mod development can save time. Here are some more ideas on how to use launch profiles:
- Use
tmlsavedirectory
to use a separate saves location. This can be useful for organization or testing specific settings you don't want to affect your normal tModLoader client. - Use
modpack
to launch the game with a specific modpack enabled. This can be useful for testing the mod in isolation or testing the mod against specific optional dependencies.