Command line

From TTWiki
Revision as of 04:05, 18 January 2004 by admin (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

How to specify the patches directly on the command line.

Command Line

How to specify the patches directly on the command line.

The command line is an alternative way of selecting the patches.  The format of the command line is

-+TTDPatch <nowiki>[-C cfg-file]</nowiki> <nowiki>[options]</nowiki> <nowiki>[CD Path]</nowiki> <nowiki>[-W cfg-file]</nowiki>+-

The options can start with either a - (dash) or / (slash), followed by the list of options.  All options can have another - after them to turn them off, and if there's an option that takes a parameter, the next option will be used as that value.

Each option is given by either a single letter, or by a capital "X" or "Y"  followed by a letter, e.g. -abcXaXbYc.  Note that all switches are case sensitive, and distinguish between upper case and lower case. Therefore, -g and -G are different switches.

In addition to all the patch switches (see The Patches), the following options control operation of TTDPatch:

-a
Turn on all patch switches except for "morevehicles" and "experimentalfeatures"
-h
Show a brief help summarizing all available options.  Run  ttdpatch -h | more if it scrolls by too fast.
-v
Before running TTD, display a brief summary of what switches are active
-C <file>
Select a different configuration file (see Configuration File)
-W <file>
Write current configuration to this file

If the -C option is given, the specified configuration file will be read instead of the default -+ttdpatch.cfg+-.  You can use several configuration files by having multiple -C switches, they will be read in the order you supply them.

In addition, if you have given a CD Path, if will be passed to TTD and tell it where it should go looking for the CD.  (This only applies to the DOS version.)

Some switches don't have associated short command line switches, for example the many switches that control  town growth rate calculation (see New Town Growth Switches).  However, you can use a so-called `long switch', which is two dashes followed by the full switch name, for example -+--towngrowthratemin=50+- or -+--trainrefit on+-.  This is not as useful for the DOS version, which has a limit of 127 characters for the command line, but the Windows version has no such limit (although the command interpreter -+COMMAND.COM+- does,  so under Windows 95/98/Me you may have to use an external tool to specify many long switches).

And finally, after you have set all your switches the way you like them, you can tell TTDPatch to write them to your own configuration file (or -+ttdpatch.cfg+- for that matter) by using the -W switch.  With this, TTDPatch will create a commented file that has all the switches set as they are when the -W is encountered on the command line.

If you need a short reminder of all options, run `ttdpatch -h' which will show a short summary of all command line switches.  If it's too much to fit on your screen, try `ttdpatch -h|more'.

A few examples to explain how the command line works:

-+ttdpatch -an- -i 90 -v+-

will start TTDPatch will all switches enabled (a) except for the new non-stop handling (n-) which is turned off.  The default service interval is set to 90 days (-i 90), and before running TTD, all switches will be displayed to verify they are the way you want (-v).

-+ttdpatch -C mycfg.cfg+-

will use the file -+mycfg.cfg+- instead of the default -+ttdpatch.cfg+- to set the patches.

-+ttdpatch -C mycfg.cfg -f- -W mycfg.cfg+-

This will read -+mycfg.cfg+-, disable train refitting, and write the new configuration back to -+mycfg.cfg+- and then run TTD.