TrainzUtil

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
(TANE and TRS19)
(TS12 and Earlier Trainz Releases)
Line 22: Line 22:
 
==TS12 and Earlier Trainz Releases==
 
==TS12 and Earlier Trainz Releases==
  
Prior to [[TrainzUtil]] is a command line utility and cannot be started from the [[Help:TRS19 Launcher|Trainz Launcher]].
+
Prior to [[TrainzUtil]] is a command line utility and cannot be started from any Trainz window.
*To start [[TrainzUtil]] open a command prompt and navigate to your Trainz "bin" directory (e.g. C:\Program Files\Auran\TS2010\Bin or D:N3V Games\Trainz A New Era etc).  
+
*To start [[TrainzUtil]] open a command prompt with administrator privileges and navigate to the "bin" directory in the Trainz program folder (e.g. "c:\Program Files\Auran\TS2010\Bin or D:N3V Games\Trainz A New Era\bin\").  
*You can then launch [[TrainzUtil]] with command arguments as below.<br>
+
*You can then execute a [[TrainzUtil]] command with the arguments below.<br>
  
 
==TANE and TRS19==
 
==TANE and TRS19==

Revision as of 00:21, 5 June 2020

TrainzUtil is a command line Content Management tool.

Contents

Functionality

TrainzUtil is capable of performing some content management tasks including:

  • Installation, removal and editing of custom content.
  • Limited searching of local content.
    • However the "searchbycategory" argument gives access to Download Station queries as well.
  • Packaging local content for distribution.
  • Provides a command line interface for content management functions. This enables users to write batch files or external programs that can query or modify the asset library at hand or query Download Station content.

TrainzUtil provides a small subset of the available content management functions, for most operations Content Manager should be used.


Set Up

To use TrainzUtil in TANE and TRS19, the user must first select the "Enable advanced debug tools" option in the "Dev" tab of the Trainz Settings dialog box.

Prior Trainz releases do not require this step.

Usage

TS12 and Earlier Trainz Releases

Prior to TrainzUtil is a command line utility and cannot be started from any Trainz window.

  • To start TrainzUtil open a command prompt with administrator privileges and navigate to the "bin" directory in the Trainz program folder (e.g. "c:\Program Files\Auran\TS2010\Bin or D:N3V Games\Trainz A New Era\bin\").
  • You can then execute a TrainzUtil command with the arguments below.

TANE and TRS19

  • You can run TrainzUtil commands from any Trainz window, except the simulator window, using the "Developer" menu > "Run Trainzutil Command...".

Command Line Arguments

NOTE: Due to the Windows command prompt treating the '<' and '>' characters as pipe operators, be sure to include quotes around any KUID arguments. For example:

   trainzutil delete "<kuid:87854:982511580>"
  • TrainzUtil help
Display TrainzUtil help text. (...start here to see all current command line entries available)
  • TrainzUtil version
Display the TrainzUtil build version.
  • TrainzUtil echo <TEXT>
Echo the supplied text.
  • TrainzUtil time
Echoes the current time in RFC 822 format.
  • TrainzUtil setlanguage <langCode>
Set the Trainz language to the language code supplied (eg. US, FR, RU, etc).
  • TrainzUtil installCDP <PATH>
Install an asset from a CDP file.
  • TrainzUtil installfrompath <PATH>
Install an asset from a directory.
  • TrainzUtil installfromdls <KUID>
Install an asset from the Auran Download Station.
  • TrainzUtil edit <KUID>
Open an asset for editing.
  • TrainzUtil generateKUID
Generate a new KUID number in the local user's KUID range.
  • TrainzUtil createCDP <OUTPUT PATH> <KUID1> <KUID2> ... <KUIDX>
Export assets to a CDP file.
  • TrainzUtil repairdatabase
Repairs the Trainz Asset Database.
  • TrainzUtil repairdatabase extended
Forces DLC packages to be reinstalled and fully repairs database corruption. Details here
  • TrainzUtil printconfig <KUID>
Print the contents of an assets config file to the console.
  • TrainzUtil backupkeywords
Backup all the keywords of your assets.
  • TrainzUtil importkeywords
Import keywords into the Trainz Asset Database.
  • TrainzUtil add-keyword <keyword> <KUID> [..]
Add a keyword to the specified assets.
  • TrainzUtil remove-keyword <keyword> <KUID> [..]
Remove a keyword from the specified assets.
  • TrainzUtil search-by-keyword <keyword>
Returns a list of all assets with the specified keyword.
  • TrainzUtil commit <KUID>
Commit any edits that have been made to the specified asset.
  • TrainzUtil revert <KUID>
Discard any edits that have been made to the specified asset.
  • TrainzUtil delete <KUID>
Delete the specified asset from disk.
  • TrainzUtil list <KUID> [..]
Parses the specified kuid list into the results.
  • TrainzUtil list-latest-versions <KUID>
Get the latest known version of an asset. Multiple KUIDs may be specified as multiple arguments.
  • TrainzUtil list-dependencies <KUID>
Get an assets direct dependencies.
  • TrainzUtil list-dependants <KUID>
Get an assets direct dependants.
  • TrainzUtil authors
List of all the authorIDs that have content in the game.
  • TrainzUtil searchbycategory [-a] <CategoryList>
List all the local assets with a category set in this format, "CMP;MESH|BD;-ACTV|VE|SCEN".
  • Arguments:
  • <CategoryList> is defined as follows:
    • If all parameters are omitted, lists all local assets installed.
    • -ACTV will list all local assets except Industries
    • CMP will list all local payware assets.
    • SCEN argument will list local scenery (and Buildings)
  • TrainzUtil filterbystatus <status> <KUID>
List all assets from the specified list which match the specified status flags.
  • TrainzUtil importconsists <PATH>
Import an old style Surveyor consist list, creating consist assets for any unknown entries.
  • TrainzUtil setnextcontentid <int>
Provides a 'next content ID' hint for the KUID generator.
  • TrainzUtil status <KUID>
Print the status of the specified asset.
This will output + <KUID> : <Flags> : <category> : <username> where flags are a series of letters with case indicating boolean state. (capital letters are flagged true and lowercase are flagged false.)
  • Aa - The asset is archived.
  • Bb - The asset is builtin or packaged content.
  • Cc - The asset is in the base content set.
  • Dd - The asset is on the download station.
  • Ee - The asset is open for edit.
  • Ff - The asset is faulty.
  • Ii - The asset is installed locally.
  • Ll - The asset is locally modified.
  • Mm - The asset has missing dependencies.
  • Oo - The asset is obsolete.
  • Pp - The asset is listed in the DLS index as payware DLC.
  • Uu - The asset has an update available.
  • Xx - The asset is authorised for use in this Trainz installation.
  • TrainzUtil validate <KUID>
Perform validation and display any errors or warnings relating to this asset.
  • TrainzUtil compile <PATH>
Compile a script file.
  • <-d> Display gamescript documentation.
  • <-s> Silent mode.
  • <-bPATH> Specify a file path for the compile log.
  • <-pPATH> Specify the output directory.
  • <-oPATH> Specify the output library filename.
  • <PATH> Input source file.
  • <-iPATH> Additional include path.
  • TrainzUtil convert-config <PATH>
Converts a config.txt file to config.chump or vice versa.
  • TrainzUtil open-in-driver [-wait] <KUID>
Open the specified route or session asset in Driver. Optionally wait until the module is exited.
  • TrainzUtil open-in-surveyor [-wait] <KUID>
Open the specified route or session asset in Surveyor. Optionally wait until the module is exited.
  • TrainzUtil open-in-preview [-wait] <KUID>
Open the specified route or session asset in the asset preview tool. Optionally wait until the module is exited.
  • TrainzUtil encrypt <PATH>
Encrypt a script file (gs --> gse).
  • TrainzUtil export-package <device-type> <package-name> <package-build-number> [<dependency-package-name> ...] <kuid>
Export assets to a device package. Multiple KUIDs may be specified as multiple arguments.
  • TrainzUtil update-package <package-name>
Update prebuilt data within a package.
  • TrainzUtil install-package <PATH>
Install a package from the specified path.
  • TrainzUtil clean-package [-a] <package-name>
Remove the local build's prebuilt data from within a package. Use the -a parameter if you want to strip all prebuilt data.
  • TrainzUtil uninstall-package <package-name>
Uninstall the specified package.
  • TrainzUtil list-package-assets <package-name>
List the assets available in the specified package.
  • TrainzUtil prebuild [--force] [--nofail] [--clear] [<KUID> ..]
Precache all installed content.
  • TrainzUtil downloadcontentlistings
Fully download the latest content listings.
  • TrainzUtil listbuilds <PATH>
Print the list of installed build numbers to a file.
  • TrainzUtil quit
Requests the GUI to close.
  • TrainzUtil async <command..>
Begins running the specified command asynchronously.
  • TrainzUtil sync
Waits for all async commands to complete.
  • TrainzUtil wait <seconds>
Pause for the specified number of seconds.
  • TrainzUtil @<file.txt>
Batch-execute a series of commands from the specified text file (every argument must be between double quotes). Every line of that text file will be processed like a separate call to TrainzUtil
  • set <variable> <command..>
Used in a batch file, runs the specified command and overwrites the named variable with the result.
  • append <variable> <command..>
Used in a batch file, runs the specified command and appends the result into the named variable.
  • iferr <variable> <command..>
Used in a batch file, runs the specified command only if the named variable contains one or more errors.
  • iferrflag <command..>
Used in a batch file, runs the specified command only if an error has occurred in the batch file execution up to this point.
  • ifnone <variable> <command..>
Used in a batch file, runs the specified command only if the named variable contains no assets.
  • ifhas <variable> <command..>
Used in a batch file, runs the specified command only if the named variable contains one or more assets.
  • print <variable>
Used in a batch file, prints the content of the named variable.
  • printerrors <variable>
Used in a batch file, prints any errors contained in the named variable.
  • abort <TEXT>
Used in a batch files, aborts processing of the batch file immediately without raising any further errors. If arguments are present, they are logged as a single error string.
  • $(<variable>)
Used as a command parameter in a batch file, replaced with the KUID(s) from the specified variable.

Notes

  • Due to the Windows command prompt treating the '<' and '>' characters as pipe operators, be sure to include quotes around any KUID parameters. For example:
   trainzutil delete "<kuid:87854:982511580>"
  • The console output of a TrainzUtil command is not the same as when it is executed from the Trainz program launch window

Content Creation

Personal tools