OpenTTDDevBlackBook/Special strings

From OpenTTD
Jump to: navigation, search
HAL (Hardware Abstraction Layer)

Audio
Music
Graphic

Window System

Using the Window System
Colour codes that exist in OpenTTD
Adding a text box
Understanding the widget focus system

Settings

Add a setting
Add a squirrel function
Do a savegame BUMP

The Map / Scenario

Understanding the Dynamic Landscape Array
Understanding the SaveGame Handler
HOWTO - Create good Scenarios
HOWTO - Add New Town Name Generators

The actual simulation

Vehicles
Using Orders
Pathfinding
Ratings
Train Acceleration

Language and Strings

Format of langfiles
Using OpenTTD Strings
List of Special Strings

Multiplayer

The Core Interface

Starting a Server
Connecting to a Server
Using the list of LAN/Internet Games

The OpenTTD TCP Protocol
The OpenTTD UDP Protocol
HOWTO - Debug desyncs

Ingame Console

The Console Window
Using Console Scripting
HOWTO - Add Functions/Commands to the Console
HOWTO - Add Variables to the Console
HOWTO - Direct Variable Access using ICONSOLE_VAR_POINTER
OpenTTD Console Commands
OpenTTD Console Variables
Development History

End-user available texts allow to make use of special strings which allow to deal as placeholders and symbols, adjustments due to inflection, or change the formatting.

Contents

General

Special Strings are always enclosed in curly brackets. Depending on the content within these curly brackets a certain command is triggered. These commands can be grouped as follows:

  1. Replacement for symbols such as a train symbol, a bus symbol, or the "X" symbol at the top of a window to close it,
  2. Change formatting such as making text colour look green/red/..., or changing the font size,
  3. Placeholders such as another string, a value for a cargo that is waiting at a station, or a vehicle's number,
  4. Inflection such as adjustments to other words to allow context-aware translation.

See below for a complete list of commands currently available:

Klipper.png

To Do
Verify that the list below really is complete!

Special characters and symbols

Command Description
{} Go to the next line
{NBSP} non-breaking space
{{} {
{CENT} ¢
{EURO}
{POUNDSIGN} £
{YENSIGN} ¥
{UPARROW}
{DOWNARROW}
{RIGHTARROW}
{SMALLUPARROW} small ↑
{SMALLDOWNARROW} small ↓
{COPYRIGHT} ©
{REGISTERED} ®
{CHECKMARK} (a checkmark)
{CROSS} (an X, used for closing windows)
{TRAIN} icon of a train
{LORRY} icon of a lorry / truck
{BUS} icon of a bus
{PLANE} icon of a plane
{SHIP} icon of a ship
{STATIONFEATURES} small icons of the supported vehicle types of a specific station

Formatting

Command Description
{TINYFONT} switch to tiny font
{BIGFONT} switch to big font

{BLACK}  {WHITE}
{RED}    {GREEN}
{BLUE}   {YELLOW}
{ORANGE} {PURPLE}
{GRAY}   {BROWN}
{SILVER} {GOLD}
{CREAM}  {LTBLUE}
{DKBLUE} {DKGREEN}
{LTBROWN}

Change the colour of the string, or the part of string until overridden by another colour to this colour.
Notice.png

Note
The default font size is medium.

Placeholders

Formatted Numbers
Command Number of Params used Description Example (using EN-UK locale)
{NUM} 1 show a 32-bit signed integer number 1600
{COMMA} 1 show a 32-bit signed integer number with a thousands separator 14,000
{CURRENCY} 1 number as a currency (with maximal value of approx. 4 billion) € 230,000
{CURRENCY64} 1 a 64-bit number extended with currency symbols € 10,000,000,00
{CURRCOMPACT} 1 short version of currency (used in graphs)
{CURRCOMPACT64} 1 a compacted 64-bit number extended by currency symbols
{DATE_TINY} 1 tiny date version 01-07-2004
{DATE_SHORT} 1 short date version February 2004
{DATE_LONG} 1 long date version 25th February 2004
{FORCE} 1 show number as force 1500kN
{POWER} 1 show number as power 6000HP
{VELOCITY} 1 show number as speed 120km/h or 195mph
{VOLUME} 1 show number as volume 1,000 litres
{VOLUME_S} 1 show number as volume 1,000L
{WEIGHT} 1 show number as weight 1,000 tonnes
{WEIGHT_S} 1 show number as weight 1,000T
{CARGO} 2 show number as cargo 950 tonnes of Coal
{SHORTCARGO} 2 number with cargo units 950 tonnes
Plain String Replacements
Command Number of Params used Description Comment
{STRING} 1 get a string without parameters from an index
{STRING1} 2 get a string with 1 parameter Use in english.txt only; in other language files use {STRING} instead.
Note that these commands may lead to a nested resolution of commands. For details, refer to here.
{STRING2} 3 get a string with 2 parameters
{STRING3} 4 get a string with 3 parameters
{STRING4} 5 get a string with 4 parameters
{STRING5} 6 get a string with 5 parameters
{STRING6} 7 get a string with 6 parameters
{STRING7} 8 get a string with 7 parameters
{RAW_STRING} 1 get a verbatim string Use in english.txt only; in other language files use {STRING} instead.
Additional information on how RAW_STRINGs are being used can be found here.
String Replacements with semantics
Command Number of Params used Description
{COMPANY} 1 get the company name pointed to by this index
{PLAYERNAME} 1 get the player name pointed to by this index
{STATION} 1 get the station name pointed to by this index
{TOWN} 1 get the town name pointed to by this index
{INDUSTRY} 1 get the industry name pointed to by this index
{WAYPOINT} 1 get the waypoint name pointed to by this index
{VEHICLE} 1 get the vehicle name pointed to by this index
{GROUP} 1 get the vehicle group name pointed to by this index
{ENGINE} 1 get the engine name pointed to by this index
{SIGN} 1 get the sign name pointed to by this index
Miscellaneous other Placeholders
Command Number of Params used Description
{REV} 0 OpenTTD revision string

Inflection

Command Number of Params used Description References
{P} 0 Plural modifier Further information on using plural special strings in strings
{G} 0 Gender modifier Further information on using genders in strings
Personal tools