Difference between revisions of "NML:Town names parts"
(add nav template) |
Planetmaker (talk | contribs) m (some spelling and linke to other part of townname docs) |
||
Line 1: | Line 1: | ||
{{NMLNavBlocksyntax}} |
{{NMLNavBlocksyntax}} |
||
− | A <code style="color:darkgreen">town_names</code> block has one or more <code style="color:darkgreen"><part></code>s. Each part defines a piece of a town name. All pieces together form the name generated by the block. |
+ | A <code style="color:darkgreen">town_names</code> block has one or more <code style="color:darkgreen"><part></code>s. Each part defines a piece of a town name. All pieces together form the name generated by the [[NML:town_names|townname]] block. |
An example of a part is: |
An example of a part is: |
||
Line 11: | Line 11: | ||
} |
} |
||
− | The simplest form is just a list of <code style="color:darkgreen">text(...)</code>entries. Each entry contains a possible value of piece, and a probability of picking that name. The <code style="color:darkgreen">town_names(<name>, <probability>)</code>calls a previous <code style="color:darkgreen">town_names</code> block (called 'othernames' in the example), and returns the value generated there. A part should have at least one. |
+ | The simplest form is just a list of <code style="color:darkgreen">text(...)</code>entries. Each entry contains a possible value of piece, and a probability of picking that name. The <code style="color:darkgreen">town_names(<name>, <probability>)</code>calls a previous <code style="color:darkgreen">town_names</code> block (called 'othernames' in the example), and returns the value generated there. A part should have at least one entry. Up to 255 entries will always work. If a part contains even more entries, NML tries to make it fit by creating sub-blocks. If that fails, you will get an error. |
The numbers are the probabilities. In the example, the sum of all values is 6, which means that <code style="color:darkgreen">name1</code> is picked with 1/6 chance, <code style="color:darkgreen">name2</code> has a 2/6 chance, and a name generated from the previous <code style="color:darkgreen">town_names</code> block has a 3/6 chance. |
The numbers are the probabilities. In the example, the sum of all values is 6, which means that <code style="color:darkgreen">name1</code> is picked with 1/6 chance, <code style="color:darkgreen">name2</code> has a 2/6 chance, and a name generated from the previous <code style="color:darkgreen">town_names</code> block has a 3/6 chance. |
Latest revision as of 22:10, 1 February 2014
Vehicles, Stations, Canals, Bridges, Towns, Houses, Industries (Tiles), Cargos, Airports+Tiles, Objects, Railtypes, Roadtypes, Tramtypes, Terrain
A town_names
block has one or more <part>
s. Each part defines a piece of a town name. All pieces together form the name generated by the townname block.
An example of a part is:
{ text("name1", 1), text("name2", 2), town_names(othernames, 3) }
The simplest form is just a list of text(...)
entries. Each entry contains a possible value of piece, and a probability of picking that name. The town_names(<name>, <probability>)
calls a previous town_names
block (called 'othernames' in the example), and returns the value generated there. A part should have at least one entry. Up to 255 entries will always work. If a part contains even more entries, NML tries to make it fit by creating sub-blocks. If that fails, you will get an error.
The numbers are the probabilities. In the example, the sum of all values is 6, which means that name1
is picked with 1/6 chance, name2
has a 2/6 chance, and a name generated from the previous town_names
block has a 3/6 chance.