Difference between revisions of "NML:Town names"
(Added an example.) |
Planetmaker (talk | contribs) (Add link to town name parts) |
||
| Line 13: | Line 13: | ||
The optional <code style="color:darkgreen"><string></code> defines how the town names are called in the menu. It may only be defined in a top-names block. To make the name available in all languages, it is probably a good idea to at least define a menu name for the generic language. |
The optional <code style="color:darkgreen"><string></code> defines how the town names are called in the menu. It may only be defined in a top-names block. To make the name available in all languages, it is probably a good idea to at least define a menu name for the generic language. |
||
| + | |||
| + | The townname <code style="color:darkgreen"><part></code>s define the actual strings and their probability of the [[NML:Town_names_parts|parts]] which townnames consist of. |
||
== Example == |
== Example == |
||
Latest revision as of 22:07, 1 February 2014
Vehicles, Stations, Canals, Bridges, Towns, Houses, Industries (Tiles), Cargos, Airports+Tiles, Objects, Railtypes, Roadtypes, Tramtypes, Roadstops, Terrain
To define randomly generated town names, the town_names block should be used. Such blocks can be used in two ways, as generator of (partial) town names for another block, or as top-level town names block, a starting point of town names in the grf file. You must have at least one starting point, but you can have more than one.
The general syntax of a town names block is:
town_names[(<name>)] {
[styles : <string>]
<part> <part> ....
}
The optional <name> defines the name of the block. Such a name is used to refer to this block from another town names block. For top-level town names blocks, it is often left out. Note that in that case, you must also leave out the parentheses.
The optional <string> defines how the town names are called in the menu. It may only be defined in a top-names block. To make the name available in all languages, it is probably a good idea to at least define a menu name for the generic language.
The townname <part>s define the actual strings and their probability of the parts which townnames consist of.
Example
In this example, town names are randomly constructed from two parts. Note that the top-level block is on the bottom; this is necessary so it can reference the other two blocks. Have a look at the NML:Town_names_parts section for more info on the syntax used in this example.
town_names(one) {
{
text("Avon", 31),
text("Black", 10),
...
}
}
town_names(two) {
{
text(" Bridge", 1),
text("ton", 1),
...
}
}
town_names {
styles : string(STR_STYLES);
{
town_names(one,3)
}
{
town_names(two,1)
}
}
This will generate:
Avon Bridge Avonton Black Bridge Blackton