ReadingOtherGRFParameters: Difference between revisions

From GRFSpecs
Jump to navigation Jump to search
Content deleted Content added
Rubidium (talk | contribs)
No edit summary
if only assignment is valid, then put it directly into the syntax
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
==Introduction==


Since TTDPatch 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.
'''''Reading another GRF file's parameters'''''


== Format ==
==Reading another GRF file's parameters==


<pre> &lt;Sprite-number&gt; * &lt;Length&gt; 0D &lt;target&gt; 00 &lt;param&gt; FE &lt;GRFID&gt;</pre>
-=Introduction=-


{| class="wikitable"
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.
|-
!'''Element'''
![[GRFActionsDetailed|'''Size''']]
!'''Description'''
|-
|0D
|B
|Defines action 0D
|-
|&lt;target&gt;
|B
|Target parameter
|-
|&lt;param&gt;
|B
|Parameter number of the other GRF file that you want to read
|-
|FE
|B
|Defines a special variable access
|-
|&lt;GRFID&gt;
|D
|The GRFID whose parameter you want to read
|}


This will store parameter &lt;param&gt; of the GRF file with GRFID &lt;GRFID&gt; into the &lt;target&gt;
-=Format=-

<pre> -+&lt;Sprite-number&gt; * &lt;Length&gt; 0D &lt;target&gt; &lt;operation&gt; &lt;param&gt; FE &lt;grfid&gt;+-</pre>

||'''Element'''|[[GRFActionsDetailed|'''Size''']]|'''Description'''

0D|B|Defines action 0D

&lt;target&gt;|B|Target parameter

&lt;operation&gt;|B|As for [[ActionD#operation|action D]], but only assignment is valid.

&lt;param&gt;|B|Parameter number of the other GRF file that you want to read

FE|B|Defines a special variable access

&lt;grfid&gt;|D|The GRFID whose parameter you want to read||

This will store parameter &lt;param&gt; of the GRF file with grfid &lt;grfid&gt; into the &lt;target&gt;


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.


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).
If the GRFID 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).

Latest revision as of 16:55, 18 March 2015

Introduction

Since TTDPatch 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> 00 <param> FE <GRFID>
Element Size Description
0D B Defines action 0D
<target> B Target parameter
<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 GRFID 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).