Difference between revisions of "Callback: Show additional text in industry window"
(use new grf templates) |
|||
Line 1: | Line 1: | ||
== Show additional text in industry window (3A) == |
== Show additional text in industry window (3A) == |
||
− | This callback allows you to display extra information in the industry window about the state of your |
+ | This callback allows you to display extra information in the industry window about the state of your industry. |
+ | {| |
||
− | {{grfFrom|8}} For GRF version 8 and above you can return 400 to display no text (instead of failing the callback). |
||
+ | |- |
||
+ | !Return value!!Version!!Meaning |
||
+ | |- |
||
+ | |0000..03FF|| ||D0xx text to display. |
||
+ | |- |
||
+ | |0400||{{grfFrom|8}}||Display no text (same as callback failure). |
||
+ | |- |
||
+ | |040F||{{ottdp|15|no}}||Display text using text ID from register 0x100 (not limited to D0xx texts). The text stack starts at register 0x101. |
||
+ | |} |
||
+ | |||
+ | The text must begin with a colouring special character and should not be longer than one line. For example, you can use this callback to display the current production limit of a secondary industry. |
||
{{ottd|0.6|r11987}} Note that since r11987, OpenTTD allows resizing the window when this callback is enabled. It allows to specify a text containing more than one line. |
{{ottd|0.6|r11987}} Note that since r11987, OpenTTD allows resizing the window when this callback is enabled. It allows to specify a text containing more than one line. |
||
− | {{ottdp|0.6|2.6|ttdprev=r1370}} Since TTDPatch 2.6 r1370, the contents of registers 100h..105h are copied onto the text reference stack. This allows you to display dynamically calculated values in the text by using the according StringCodes. Please note, though, that the text handler will see it as an array of bytes, not as an array of DWORDs, so you will have to pack two words into a register when you use codes that read words from the stack. In the case of \7D (which gets a byte), you may have to pack more into a register, but it's probably easier to use \7C instead. |
+ | {{ottdp|0.6-14|2.6|ttdprev=r1370}} Since TTDPatch 2.6 r1370, the contents of registers 100h..105h are copied onto the text reference stack. This allows you to display dynamically calculated values in the text by using the according StringCodes. Please note, though, that the text handler will see it as an array of bytes, not as an array of DWORDs, so you will have to pack two words into a register when you use codes that read words from the stack. In the case of \7D (which gets a byte), you may have to pack more into a register, but it's probably easier to use \7C instead. |
+ | |||
+ | {{ttdp|}} Please also note that you can use \80 to display textIDs calculated on the fly, but DCxx textIDs won't work correctly. When you need to choose from your own texts dynamically, you must use D0xx IDs, and add 400h to them. (That is, use D400 to refer to D000, D401 for D001 etc.) |
||
+ | |||
+ | {{ottdp|15|no}} The contents of registers 100h..10Fh are copied onto the text reference stack. |
||
This callback is available from {{ttdp|2.5}} TTDPatch 2.0.1 a72 and above |
This callback is available from {{ttdp|2.5}} TTDPatch 2.0.1 a72 and above |
Latest revision as of 13:52, 13 May 2025
Show additional text in industry window (3A)
This callback allows you to display extra information in the industry window about the state of your industry.
The text must begin with a colouring special character and should not be longer than one line. For example, you can use this callback to display the current production limit of a secondary industry.
0.6 Note that since r11987, OpenTTD allows resizing the window when this callback is enabled. It allows to specify a text containing more than one line.
0.6-14
2.6 Since TTDPatch 2.6 r1370, the contents of registers 100h..105h are copied onto the text reference stack. This allows you to display dynamically calculated values in the text by using the according StringCodes. Please note, though, that the text handler will see it as an array of bytes, not as an array of DWORDs, so you will have to pack two words into a register when you use codes that read words from the stack. In the case of \7D (which gets a byte), you may have to pack more into a register, but it's probably easier to use \7C instead.
Please also note that you can use \80 to display textIDs calculated on the fly, but DCxx textIDs won't work correctly. When you need to choose from your own texts dynamically, you must use D0xx IDs, and add 400h to them. (That is, use D400 to refer to D000, D401 for D001 etc.)
15
The contents of registers 100h..10Fh are copied onto the text reference stack.
This callback is available from 2.5 TTDPatch 2.0.1 a72 and above