Difference between revisions of "NML:Town names parts"

From GRFSpecs
Jump to navigationJump to search
(content of nml r1625)
 
(add nav template)
Line 1: Line 1:
  +
{{NMLNavBlocksyntax}}
  +
 
A <code style="color:darkgreen">town_names</code> block has one or more <code style="color:darkgreen">&lt;part&gt;</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">&lt;part&gt;</code>s. Each part defines a piece of a town name. All pieces together form the name generated by the block.
   

Revision as of 16:38, 21 August 2011

Block Syntax

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 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. At least 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.