NMLTutorial/Parameters
Introduction
NewGRF Parameters in NML are part of the grf block
grf { grfid: "NML\FF"; name: string(STR_GRF_NAME); desc: string(STR_GRF_DESC); version: 1; min_compatible_version: 0; param <num> { <name> { name: string(STR_PARAM_NAME_ECONOMIES); desc: string(STR_PARAM_DESC_ECONOMIES); <specifics> } } }
Where name is the name the parameter is referenced further within the grf to read this parameter. <num> is the number of this parameter. The meaning of the <num> parameter should should remain constant throughout versions of the same NewGRF or the NewGRF might become incompatible with previous versions of the same NewGRF (thus you'd need to change min_compatible_version if you change the meaning of the parameters at <num>.
Parameter types
NML knows three different types of parameters, boolean, numeric ones and enumerations:
Boolean parameter
The boolean parameter is the easiest as it requires no further definitions besides the name and description. Optionally a single parameter can contain several boolean parameter values, each using a single bit, thus saving in the number of externally visible NewGRF parameters.
param 3 { // 3rd parameter of the NewGRF param_bool_1 { // 1st boolean value name: string(STR_PARAM_NAME_DEBUG); desc: string(STR_PARAM_DESC_DEBUG); type: bool; bit: 1; // uses 1st bit } param_bool_2 { // 2nd boolean value name: string(STR_PARAM_NAME_DEBUG); desc: string(STR_PARAM_DESC_DEBUG); type: bool; bit: 2; // uses 2nd bit } }