NML:Block syntax

From GRFSpecs
Revision as of 00:51, 9 September 2011 by Planetmaker (talk | contribs) (Overview page for general language structure)
Jump to navigationJump to search
Block Syntax

Syntax

In the next sections you'll often see a word enclosed by the less-than and greater-than symbols. These words should not be written literally, instead they reference to another block/item you should put there. The following words will be used:

<literal-string>
A string enclosed by quotes, for example "this is a literal string"
<string>
A string defined in the language file, for example string(STR_GRF_NAME)
<expression>
An expression, this can be a computation or single value constructed using <number>, <float>, <parameter>, <variable>, <function-call>
<ID>
The name of an item or block. IDs should start with a letter or underscore. The rest of the ID may consist of letters, underscores and numbers.

If something is enclosed by square brackets [] it's optional.

GRF

Item

Realsprites

Recolour sprites

Template

Spriteset

Spritegroup

Spritelayout

Tilelayout

Switch

Produce

Random switch

Cargotable

Railtypetable / Roadtypetable / Tramtypetable

If/else

While

Error

Disable items

Deactivate other NewGRFs

Testing for other NewGRFs

Overriding vehicles in other NewGRFs

Sprite replacement

Alternative (32bpp) sprites

Town names

Snow line

Parameter assignment

Setting base costs

Sorting vehicles in the purchase list

Features

NewGRFs can be used to modify various types of items. Examples include trains, stations and industries. Such a type of item is called a feature. The following table contains a list of features and their identifiers. These identifiers may be used to refer to the feature when needed.

Name Description
FEAT_TRAINS Trains
FEAT_ROADVEHS Road vehicles
FEAT_SHIPS Ships
FEAT_AIRCRAFT Aircraft
FEAT_STATIONS Train stations
FEAT_CANALS Canals
FEAT_BRIDGES Bridges
FEAT_HOUSES Town houses
FEAT_GLOBALVARS Various global variables
FEAT_INDUSTRYTILES Industry tiles (visible part of industries)
FEAT_INDUSTRIES Industries
FEAT_CARGOS Cargo types
FEAT_SOUNDEFFECTS Sound effects
FEAT_AIRPORTS Airports
FEAT_SIGNALS Train signals
FEAT_OBJECTS Non-interactive objects (example: lighthouse)
FEAT_RAILTYPES Rail types
FEAT_ROADTYPES Road types
FEAT_TRAMTYPES Tram types
FEAT_AIRPORTTILES Airport tiles (visible part of airports)