[NFO] Adding additional text

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Post Reply
User avatar
Quast65
Tycoon
Tycoon
Posts: 2665
Joined: 09 Oct 2011 13:51
Location: The Netherlands

[NFO] Adding additional text

Post by Quast65 »

Hi all!

I need a bit of help...

I have a piece of NFO code and I want to add additional text to it.
I am always having trouble how to tie up all of the Action-02s and I am stuck at the moment.

This is the working code:

Code: Select all

 7244 * 35	 00 0F 09 01 EF 08 "NLRM" 0A EF D0 0B 0F 0C 11 0E D4 77 09 00 0F 00 00 20 00
	         10 2C 0C 15 10 00 17 04
 7245 * 4	 01 0F 04 01
 7246 c:/grfcodec603/dutchroad/dutchroadfurniture.png  8bpp   10 8560   64  100  -31  -69 normal chunked
 7247 c:/grfcodec603/dutchroad/dutchroadfurniture.png  8bpp   90 8560   64  100  -31  -69 normal chunked
 7248 c:/grfcodec603/dutchroad/dutchroadfurniture.png  8bpp  170 8560   64  100  -31  -69 normal chunked
 7249 c:/grfcodec603/dutchroad/dutchroadfurniture.png  8bpp  250 8560   64  100  -31  -69 normal chunked
 7250 * 17	 02 0F 00 00 00 80 00 80 00 00 00 00 00 00 00 00 00
 7251 * 17	 02 0F 01 00 01 80 00 80 00 00 00 00 00 00 00 00 00
 7252 * 17	 02 0F 02 00 02 80 00 80 00 00 00 00 00 00 00 00 00
 7253 * 17	 02 0F 03 00 03 80 00 80 00 00 00 00 00 00 00 00 00
 7254 * 4	 01 0F 04 01
 7255 c:/grfcodec603/dutchroad/dutchroadfurniture.png  8bpp   10 8665   64  100  -31  -69 normal chunked
 7256 c:/grfcodec603/dutchroad/dutchroadfurniture.png  8bpp   90 8665   64  100  -31  -69 normal chunked
 7257 c:/grfcodec603/dutchroad/dutchroadfurniture.png  8bpp  170 8665   64  100  -31  -69 normal chunked
 7258 c:/grfcodec603/dutchroad/dutchroadfurniture.png  8bpp  250 8665   64  100  -31  -69 normal chunked
 7259 * 17	 02 0F 04 00 99 0F 00 00 00 00 00 80 00 00 10 10 64
 7260 * 17	 02 0F 05 00 90 0F 00 00 01 00 00 80 00 00 10 10 64
 7261 * 17	 02 0F 06 00 96 0F 00 00 02 00 00 80 00 00 10 10 64
 7262 * 17	 02 0F 07 00 93 0F 00 00 03 00 00 80 00 00 10 10 64
 7263 * 4	 01 0F 04 01
 7264 c:/grfcodec603/dutchroad/dutchroadfurniture.png  8bpp   10 8770   64  100  -31  -69 normal chunked
 7265 c:/grfcodec603/dutchroad/dutchroadfurniture.png  8bpp   90 8770   64  100  -31  -69 normal chunked
 7266 c:/grfcodec603/dutchroad/dutchroadfurniture.png  8bpp  170 8770   64  100  -31  -69 normal chunked
 7267 c:/grfcodec603/dutchroad/dutchroadfurniture.png  8bpp  250 8770   64  100  -31  -69 normal chunked
 7268 * 17	 02 0F 08 00 99 0F 00 00 00 00 00 80 00 00 10 10 64
 7269 * 17	 02 0F 09 00 90 0F 00 00 01 00 00 80 00 00 10 10 64
 7270 * 17	 02 0F 0A 00 96 0F 00 00 02 00 00 80 00 00 10 10 64
 7271 * 17	 02 0F 0B 00 93 0F 00 00 03 00 00 80 00 00 10 10 64
 7272 * 14	 02 0F 0C 81 41 00 FF 01 08 00 04 04 04 00
 7273 * 14	 02 0F 0D 81 41 00 FF 01 09 00 04 04 05 00
 7274 * 14	 02 0F 0E 81 41 00 FF 01 0A 00 04 04 06 00
 7275 * 14	 02 0F 0F 81 41 00 FF 01 0B 00 04 04 07 00
 7276 * 22	 02 0F 10 81 48 00 03 03 01 00 01 01 02 00 02 02 03 00 03 03 00 00
 7277 * 22	 02 0F 11 81 48 00 03 03 0D 00 01 01 0E 00 02 02 0F 00 03 03 0C 00
 7278 * 10	 03 0F 01 EF 01 FF 10 00 11 00
 7279 * 14	 04 0F FF 01 EF "ÐTunnels" 00
Action 02, number 00, 01, 02 and 03 are the Menusprites.
Action 02, number 0C, 0D, 0E and 0F are the final results after a check for snowline height. (04, 05, 06, 07 are NO-SNOW graphics, 08, 09, 0A, 0B are SNOW graphics)

This is the additional text I would like to add:

Code: Select all

 7227 * 20	 04 0F FF 01 EB D0 98 "Entrance" 00
 7228 * 20	 04 0F FF 01 EC D0 98 "Exit" 00
 7229 * 20	 04 0F FF 01 ED D0 98 "Entrance" 00
 7230 * 20	 04 0F FF 01 EE D0 98 "Exit" 00
Dont mind the codeline numbers and the numbers of the amount of bytes.
The ID's are correct though (EB, EC, ED, EE).

What kind of Action-02s do I need to add and what do I need to change to the final action-02 (and action-03)?

I know I need to add at least something like this:

Code: Select all

 7231 * 23	 02 0F XX 85 0C 00 FF FF 02 EB 80 5C 01 5C 01 YY 00 57 01 57 01 ZZ 00
 7232 * 23	 02 0F XX 85 0C 00 FF FF 02 EC 80 5C 01 5C 01 YY 00 57 01 57 01 ZZ 00
 7233 * 23	 02 0F XX 85 0C 00 FF FF 02 ED 80 5C 01 5C 01 YY 00 57 01 57 01 ZZ 00
 7234 * 23	 02 0F XX 85 0C 00 FF FF 02 EE 80 5C 01 5C 01 YY 00 57 01 57 01 ZZ 00
But I am not exactly sure what to IDs should be on the XX, YY and ZZ
And I am not sure if only these 4 lines are enough, or if there is another Action-02 block needed...

And then where (if at all) I need to referr back to ID's XX (or those from another action-02 block) in the final action-02s...
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1680
Joined: 04 Mar 2005 01:07

Re: [NFO] Adding additional text

Post by OzTrans »

Quast65 wrote: 02 Aug 2023 15:42I need a bit of help...
You need to start with the Action-3 and the menu chain (FF 10 00)

Code: Select all

   -1 * 0      03 0F 01 EF 01 FF 10 00 11 00
Next add (insert) the action-2 that checks the callbacks, you need 0x015C, If you only have one text ID, you can specify it directly, otherwise you need to branch to an Action-2 (you would need that if the text strings are date dependent). Finally, just continue with your menu chain.

Code: Select all

   -1 * 0      02 0F 10 85 0C 00 FF FF 01 EB 80 5C 01 5C 01 10 00
Your code should look something like this :

Code: Select all

   -1 * 0      02 0F 10 81 48 00 03 03 01 00 01 01 02 00 02 02 03 00 03 03 00 00
   -1 * 0      02 0F 10 85 0C 00 FF FF 01 EB 80 5C 01 5C 01 10 00
   -1 * 0      03 0F 01 EF 01 FF 10 00 11 00
You can only have displayed one text string per object ID at any one time, not per object view. You may want to add all 4 options (strings) into one text string.
User avatar
Quast65
Tycoon
Tycoon
Posts: 2665
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: [NFO] Adding additional text

Post by Quast65 »

Thnx for trying to help!
OzTrans wrote: 03 Aug 2023 01:12 You can only have displayed one text string per object ID at any one time, not per object view.
To be clear, I am talking about the additional text that you can have per object view:
Example875.png
Example875.png (35.09 KiB) Viewed 3938 times
The string in orange, that is the "main" textstring and does indeed stay the same for each view (and I think that is what you are talking about).
I am already adding that by using Property-0A in the Action-00.
That textstring in black, that can be different for each of the 4 views. And that is what I want to insert into the code I put in the first post.

AFAIK I need a set of 4 0x015C callbacks, but I am having trouble with what ID's those need to get and what ID's I have to referr to within each callback (so that the right text is shown in the right view) and finally how to tie it all up again in the Action-03
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1680
Joined: 04 Mar 2005 01:07

Re: [NFO] Adding additional text

Post by OzTrans »

Quast65 wrote: 03 Aug 2023 08:26.. I am talking about the additional text that you can have per object view: ...
I wasn't talking about the Object Name [property 0x0A] at all.

It is my understanding, that the 'Additional Text' is per Object ID only.

If it is not, then you should be able to do the following :

Code: Select all

   -1 * 0      02 0F 10 81 48 00 03 03 01 00 01 01 02 00 02 02 03 00 03 03 00 00
   -1 * 0      02 0F 00 81 48 00 03 03 EC 80 01 01 ED 80 02 02 EE 80 03 03 EB 80 
   -1 * 0      02 0F 10 85 0C 00 FF FF 01 00 00 5C 01 5C 01 10 00
   -1 * 0      03 0F 01 EF 01 FF 10 00 11 00
... I need a set of 4 0x015C callbacks ...
No, you don't. What you need is a number (4) of CB results. You need to check the callback once only, but then you need to branch to another action-2 (checking the view) and returning the text IDs one by one.

A callback does not need to return a CB result immediately, you can go through many action-2s to come up with a decision.
... how to tie it all up again in the Action-03 ...
The Action-3 has just 2 options : Menu Chain (FF 10 00) and Display Chain (Default 11 00)

Then an Action-2 to check ALL callbacks that you use for an object, but each CB only once. If you have more than 1 result you branch to another action-2, otherwise return the result immediately.
User avatar
Quast65
Tycoon
Tycoon
Posts: 2665
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: [NFO] Adding additional text

Post by Quast65 »

OzTrans wrote: 03 Aug 2023 21:51 you should be able to do the following :

Code: Select all

   -1 * 0      02 0F 10 81 48 00 03 03 01 00 01 01 02 00 02 02 03 00 03 03 00 00
   -1 * 0      02 0F 00 81 48 00 03 03 EC 80 01 01 ED 80 02 02 EE 80 03 03 EB 80 
   -1 * 0      02 0F 10 85 0C 00 FF FF 01 00 00 5C 01 5C 01 10 00
   -1 * 0      03 0F 01 EF 01 FF 10 00 11 00
That worked!

But why does it work?
I dont really understand how you can have the same action-2 IDs (red circles):
Example881.png
Example881.png (4.28 KiB) Viewed 3845 times
And even an 00-ID inbetween (yellow circle), as I have used 00 earlier already.
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1680
Joined: 04 Mar 2005 01:07

Re: [NFO] Adding additional text

Post by OzTrans »

Quast65 wrote: 03 Aug 2023 23:41 That worked!
Good to hear and I have learned something too.
I don't really understand how you can have the same action-2 IDs (red circles) ...
Action-2 sprite IDs are always forward (well backwards in our world) looking. You can use and reuse the same ID multiple times regardless of order. When you branch to another action-2 ID it will always jump to the closest one above it.

It is important to (re)use the same IDs multiple times, especially in large and complex GRFs, otherwise you'd run out of them quickly as you only have 256 of them. NFORenum is a great help in keeping things working properly.
User avatar
Quast65
Tycoon
Tycoon
Posts: 2665
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: [NFO] Adding additional text

Post by Quast65 »

Well, Action-02s will always stay an enigma to me ;-)
But thnx for your help!! :bow:
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 21 guests