Difference between revisions of "Action13"

From GRFSpecs
Jump to navigationJump to search
m (2 revisions)
 
m (Fix <feature> incorrectly appearing in the format summary line)
 
(13 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 
==Description==
 
  +
{{ottdp|0.6|2.6|ttdprev=r857}}
'''''Translate GRF-specific strings'''''
 
 
=Action 13=
 
 
Translate GRF-specific strings
 
 
-=Description=-
 
 
 
Translating regular strings is easy by just overwriting them with an [[Action4|action 4]], however this is not possible for translating GRF-specific strings in the D000 or DC00 range of IDs. Instead, these must be translated with this action 13.
 
Translating regular strings is easy by just overwriting them with an [[Action4|action 4]], however this is not possible for translating GRF-specific strings in the D000 or DC00 range of IDs. Instead, these must be translated with this action 13.
   
  +
{{ottd|}}Usage of this action with OpenTTD is troublesome in multiplayer. The action does not specify a language code for the translation, but forces the translation on every player. However, GRFs with only action 13 can be loaded as [[OpenTTD static NewGRF]]. {{grfFrom|8}} GRF version 8 alleviates this problem by providing the language that is overridden.
Available since 2.6 alpha 1 (r857).
 
   
-=Format=-
+
== Format ==
   
 
The data looks as follows:
 
The data looks as follows:
   
<pre>-+&lt;sprite-number&gt; * &lt;length&gt; 13 &lt;feature&gt; &lt;grfid&gt; &lt;num-ent&gt; &lt;offset&gt; &lt;text...&gt;+-</pre>
+
<sprite-number> * <length> 13 <GRFID> (<language-id>)? <num-ent> <offset> <text...>
 
||'''Element'''|[[GRFActionsDetailed|'''Size''']]|'''Description'''
 
 
&lt;sprite-number&gt;|dec|A sequential sprite number
 
 
&lt;length&gt;|dec|The total number of bytes in the action
 
 
13|B|Action 13
 
 
&lt;grfid&gt;|4*B|The GRFID of the file whose texts are to be translated
 
 
&lt;num-ent&gt;|B|Number of strings
 
   
  +
{|
&lt;offset&gt;|W|First text ID
 
  +
|-
  +
!'''Element'''
 
![[GRFActionsDetailed|'''Size''']]
  +
!'''Description'''
  +
|-
  +
|&lt;sprite-number&gt;
  +
|dec
 
|A sequential sprite number
  +
|-
  +
|&lt;length&gt;
  +
|dec
 
|The total number of bytes in the action
  +
|-
  +
|13
  +
|B
 
|Action 13
  +
|-
  +
|<GRFID>
  +
|4*B
 
|The GRFID of the file whose texts are to be translated
  +
|-
  +
|<language-id>
  +
|B
  +
|{{grfFrom|8}} Which of TTD's languages these strings are for (only for GRF version 8 an higher)
  +
|-
  +
|<num-ent>
  +
|B
 
|Number of strings
  +
|-
  +
|<offset>
  +
|W
 
|First text ID
  +
|-
  +
|<text...>
  +
|S
 
|Zero-terminated strings
  +
|}
   
&lt;text...&gt;|S|Zero-terminated strings||
 
   
For action 13, &lt;num-ent&gt;, &lt;offset&gt; and &lt;text...&gt; work exactly as for [[Action4|action 4]], but the offset may only refer to a text ID in the D000 or DC00 range of IDs.
+
For action 13, <num-ent>, <offset> and <text...> work exactly as for [[Action4|action 4]], but the offset may only refer to a text ID in the D000 or DC00 range of IDs.
   
 
Action 13 is skipped if the given GRFID cannot be found or if the file is inactive; action 13 generates an error message and disables the current file if it appears before the GRF that it is translating.
 
Action 13 is skipped if the given GRFID cannot be found or if the file is inactive; action 13 generates an error message and disables the current file if it appears before the GRF that it is translating.

Latest revision as of 23:25, 27 January 2022

Description

Supported by OpenTTD 0.60.6 Supported by TTDPatch 2.6 (r857)2.6 Translating regular strings is easy by just overwriting them with an action 4, however this is not possible for translating GRF-specific strings in the D000 or DC00 range of IDs. Instead, these must be translated with this action 13.

Supported by OpenTTDUsage of this action with OpenTTD is troublesome in multiplayer. The action does not specify a language code for the translation, but forces the translation on every player. However, GRFs with only action 13 can be loaded as OpenTTD static NewGRF. GRFv≥8 GRF version 8 alleviates this problem by providing the language that is overridden.

Format

The data looks as follows:

<sprite-number> * <length> 13 <GRFID> (<language-id>)? <num-ent> <offset> <text...>
Element Size Description
<sprite-number> dec A sequential sprite number
<length> dec The total number of bytes in the action
13 B Action 13
<GRFID> 4*B The GRFID of the file whose texts are to be translated
<language-id> B GRFv≥8 Which of TTD's languages these strings are for (only for GRF version 8 an higher)
<num-ent> B Number of strings
<offset> W First text ID
<text...> S Zero-terminated strings


For action 13, <num-ent>, <offset> and <text...> work exactly as for action 4, but the offset may only refer to a text ID in the D000 or DC00 range of IDs.

Action 13 is skipped if the given GRFID cannot be found or if the file is inactive; action 13 generates an error message and disables the current file if it appears before the GRF that it is translating.