Difference between revisions of "NML:Railtypetable-Roadtypetable-Tramtypetable"

From GRFSpecs
Jump to navigationJump to search
(Fix incorrect note about default railtype labels.)
(added note about road and tramtypes, also label usage)
Line 1: Line 1:
 
{{NMLNavBlocksyntax}}
 
{{NMLNavBlocksyntax}}
  +
  +
'''Note:''' The syntax for <code style="color:darkgreen">roadtypetable</code> and <code style="color:darkgreen">tramtypetable</code> are identical to that of <code style="color:darkgreen">railtypetable</code> as described below
   
 
railtypetable {
 
railtypetable {
Line 10: Line 12:
 
ID : [ ID[, ID]* ]
 
ID : [ ID[, ID]* ]
   
The first ID is the name (doesn't have to be 4-bytes long), the other iDs are a list of labels that are assigned to the given name if they are available.
+
The first ID is the name (doesn't have to be 4-bytes long), the other IDs are a list of labels that are assigned to the given name if they are available.
   
 
<pre style="color:blue">
 
<pre style="color:blue">
Line 24: Line 26:
   
 
The default railtype labels are "RAIL", "ELRL", "MONO", "MGLV". See the [[RailtypeLabels|List of railtype labels]] in the NewGRF Specs for currently defined custom labels.
 
The default railtype labels are "RAIL", "ELRL", "MONO", "MGLV". See the [[RailtypeLabels|List of railtype labels]] in the NewGRF Specs for currently defined custom labels.
  +
Similarly, the default roadtype labels are "ROAD" and "ELRD", and the default tramtype labels are "RAIL" and "ELRL"
  +
  +
Note that labels are not shared between features, so the same label can be used for multiple items. For example, the label "RAIL" can be used for a railtype, roadtype, tramtype, and cargotype simultaneously without conflict.

Revision as of 13:22, 28 December 2019

Block Syntax

Note: The syntax for roadtypetable and tramtypetable are identical to that of railtypetable as described below

railtypetable {
	ITEM [, ITEM]*
}

Each ITEM can be either a 4-byte long Identifier or string or it can have this format:


ID : [ ID[, ID]* ]

The first ID is the name (doesn't have to be 4-bytes long), the other IDs are a list of labels that are assigned to the given name if they are available.

 railtypetable {
 	RAIL,
 	ELRL,
 	"3RDR",
 	RT_SHINY_RAIL: [SHNY, RAIL]
 }

The label 3RDR is written as a string because an identifier can't start with a numeric value. To reference it later you can write railtype("3RDR"). If another grf defines a railtype with label SHNY then RT_SHINY_RAIL will refer to that track type. If the railtype SHNY is not available then trains using RT_SHINY_RAIL as track type will fallback to RAIL.

The default railtype labels are "RAIL", "ELRL", "MONO", "MGLV". See the List of railtype labels in the NewGRF Specs for currently defined custom labels. Similarly, the default roadtype labels are "ROAD" and "ELRD", and the default tramtype labels are "RAIL" and "ELRL"

Note that labels are not shared between features, so the same label can be used for multiple items. For example, the label "RAIL" can be used for a railtype, roadtype, tramtype, and cargotype simultaneously without conflict.