Difference between revisions of "ReadingOtherGRFParameters"
From GRFSpecs
Jump to navigationJump to search| m (Beautify wiki markup) | m (use GRFID consistently) | ||
| Line 5: | Line 5: | ||
| == Format == | == Format == | ||
| − | <pre> -+<Sprite-number> * <Length> 0D <target> <operation> <param> FE < | + | <pre> -+<Sprite-number> * <Length> 0D <target> <operation> <param> FE <GRFID>+-</pre> | 
| {| class="wikitable" | {| class="wikitable" | ||
| Line 33: | Line 33: | ||
| |Defines a special variable access | |Defines a special variable access | ||
| |- | |- | ||
| − | |< | + | |<GRFID> | 
| |D | |D | ||
| |The GRFID whose parameter you want to read | |The GRFID whose parameter you want to read | ||
| |} | |} | ||
| − | This will store parameter <param> of the GRF file with  | + | This will store parameter <param> of the GRF file with GRFID <GRFID> into the <target> | 
| With parameter FE you can read the action 14 NewGRF version of another NewGRF in OpenTTD. It returns 0 if no NewGRF version has been set by an action 14. | With parameter FE you can read the action 14 NewGRF version of another NewGRF in OpenTTD. It returns 0 if no NewGRF version has been set by an action 14. | ||
Revision as of 16:06, 15 June 2011
Introduction
Since 2.0.1 alpha 16, it has been possible to use action D to read the parameters of other GRF files. With this, you can try to use the settings for another related GRF before falling back to a hard coded default.
Format
-+<Sprite-number> * <Length> 0D <target> <operation> <param> FE <GRFID>+-
| Element | Size | Description | 
|---|---|---|
| 0D | B | Defines action 0D | 
| <target> | B | Target parameter | 
| <operation> | B | As for action D, but only assignment is valid. | 
| <param> | B | Parameter number of the other GRF file that you want to read | 
| FE | B | Defines a special variable access | 
| <GRFID> | D | The GRFID whose parameter you want to read | 
This will store parameter <param> of the GRF file with GRFID <GRFID> into the <target>
With parameter FE you can read the action 14 NewGRF version of another NewGRF in OpenTTD. It returns 0 if no NewGRF version has been set by an action 14.
If the GRF ID cannot be found, or if the parameter is not defined, a value of 0 is used instead (no matter whether bit 7 of the operation is set or not).
