Skip to content
turtletowerz edited this page Aug 16, 2024 · 33 revisions

In addition to all the Command Line and Server Config settings available in vanilla Terraria, tModLoader adds a few listed below.


TOBEADDEDLIST

  1. -loadlib
  2. -publish, -ciprep, -publishedmodfiles, -uploadfolder
  3. -experimental
  4. XNA-FNA Args like /gldevice:OpenGL
  5. -steamworkshopfolder
  6. -audiodriver -> Overrides SDL_AUDIODRIVER
  7. -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:


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:
image

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.).

image

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.

image

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:
image

Select the launch profile you want to make a copy of (Terraria for client or TerrariaServer for server), then click Duplicate Selected Profile:
image

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.
image

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.
image

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.
Clone this wiki locally