NML:Town names parts

From GRFSpecs
Jump to navigationJump to search
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 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.