Changing texts using .GRF

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

MarkyParky
Engineer
Engineer
Posts: 89
Joined: 20 Nov 2003 15:20

Changing texts using .GRF

Post by MarkyParky »

Hello,

Before the newindustries come, I would like to change some basic texts in OpenTTD using GRF - for example I want to alter sprites of Oilwells and Rafinery into Limekiln and Cementworks to fit more into my scenario.

There is no proble with the graphics, that is working great so far (including screenshot) but I tried to change generic strings for comodity, industry etc, but my testing grf doesnt work.

So I am asking whenever it is some feature, that is not supported by OpenTTD or if I do have some errors in the GRF.

My code follows:

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 7)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
    0 * 4    06 00 00 00
    1 * 12    08 07 "DF" 02 01 "Test" 00 00
    2 * 11       04 48 FF 01 12 00 "Lime" 00
    3 * 11       04 48 FF 01 32 00 "Lime" 00
    4 * 18       04 48 FF 01 52 00 "ton of lime" 00
    5 * 19       04 48 FF 01 72 00 "tons of lime" 00
    6 * 10       04 48 FF 01 92 00 "\0eLM" 00    
Thank you very much for help.
Attachments
Example of Cementworks
Example of Cementworks
cementarna_sshot_429.png (61.43 KiB) Viewed 2754 times
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Post by PikkaBird »

It doesn't appear to work in OTTD, no.

You may be better off waiting for proper newindustry support?
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1794
Joined: 30 Mar 2005 09:43

Post by peter1138 »

You ought to use the newcargo feature to change cargo strings.
He's like, some kind of OpenTTD developer.
MarkyParky
Engineer
Engineer
Posts: 89
Joined: 20 Nov 2003 15:20

Post by MarkyParky »

Thanks for suggestions, newcargo is worth a look.
MarkyParky
Engineer
Engineer
Posts: 89
Joined: 20 Nov 2003 15:20

Post by MarkyParky »

I checked newcargo (Action 0, feature 0B), but it allows me only to change string pointer to another string. That is working fine, but I dont need to replace Oil by Coal ;) but to create new string. And that leads back to action 4. Any suggestion?
Leviath.NL
Traffic Manager
Traffic Manager
Posts: 152
Joined: 28 Jan 2006 15:00

Post by Leviath.NL »

I remember a grf that changed goods to stuff, maybe that will help?
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Post by PikkaBird »

MarkyParky wrote:Any suggestion?
Create a DCxx string with action 4, and point property 0B of the cargo to that.
User avatar
Dave
Moderator
Moderator
Posts: 17249
Joined: 26 Dec 2005 20:19
Location: North London

Post by Dave »

Leviath.NL wrote:I remember a grf that changed goods to stuff, maybe that will help?
I do believe its called worley.grf ;)
Official TT-Dave Fan Club

Dave's Screenshot Thread! - Albion: A fictional Britain
Flickr


Why be a song when you can be a symphony? r is a...
MarkyParky
Engineer
Engineer
Posts: 89
Joined: 20 Nov 2003 15:20

Post by MarkyParky »

worley.grf is not working in OTTD (or at least at latest nightly). And it uses exactly the same approach as I used in my first attempt.
Create a DCxx string with action 4, and point property 0B of the cargo to that.
I tried to do such a think, but finished up with error that string DC01 is invalid. (I used following code:)

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 7)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
    0 * 4	 03 00 00 00
    1 * 12	 08 07 "DF" 02 01 "Test" 00 00
    2 * 13       04 48 FF 01 01 DC "BLABLA" 00    
    3 * 8        00 0B 01 01 03 0C 01 DC
I have been doing some research and almost all gfrs that uses NewCargos first declare new strings using (undocumented) Action 04 Feature 0B and later on assigns this text to cargo using Action 00 Feature 0B, adressing DCxx string. But it doesnt seem to work in OpenTTD and also the logic of this approach is (due lack of documentation Action 04 Feature 0B ) kind of blackbox to me ;)
User avatar
Dave
Moderator
Moderator
Posts: 17249
Joined: 26 Dec 2005 20:19
Location: North London

Post by Dave »

Heh. FAME! :D
Official TT-Dave Fan Club

Dave's Screenshot Thread! - Albion: A fictional Britain
Flickr


Why be a song when you can be a symphony? r is a...
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Post by PikkaBird »

MarkyParky wrote:(undocumented) Action 04 Feature 0B
The feature list on the Action 4 page is incomplete, but basically you use the same feature for the action 4 as you will for the action 0 or callback that refers to it. Hence 0B.
But it doesnt seem to work in OpenTTD
It does, I assure you. :) Note that for texts which use special characters (which the prop 0C text does, either \7C or \87) it may throw a wobbler if that special character is not found...
MarkyParky
Engineer
Engineer
Posts: 89
Joined: 20 Nov 2003 15:20

Post by MarkyParky »

Okay,

lets say it is working in OpenTTD. In this case, I do not understand one think.

I use Action 4, feature 0B to create new string. According to documentation, and also accordin to GRF files I have studied so far, it should be byte value, so I use for example 01.

Code: Select all

2 * 12   04 0B 7F 01 01 "BLABLA" 00
Now I want to use Action 0, feature 0B to replace this new string at some existing cargo.

Lets say I want string "... litres of oil" to replace with my newly created BLABLA string.

Code: Select all

3 * 8    00 0B 01 01 03 0C ?? ??
In a place where I placed questionmark, there should be a word value of new textid. As long, as I use any existing TextID already in the game, everything is fine. But I do not know what value to place here to see my newly created string from Action4. So my question is, what adress belongs here? Thank you...
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Post by michael blunck »

MarkyParky wrote:2 * 12 04 0B 7F 01 01 "BLABLA" 00
Your sprite is faulty. According to http://wiki.ttdpatch.net/tiki-index.php?page=Action4 the format is as follows:

Code: Select all

<Sprite-number> * <Length> 04 <feature> <language-id> <num-ent> <offset> <text>
i.e.:

Code: Select all

 2 * 13   04 0B 7F 01 00 DC "BLABLA" 00
 2 * 13   04 0B 7F 01 01 DC "BLUBLU" 00
Hence

Code: Select all

 3 * 8    00 0B 01 01 03 0C 01 DC
HTH
Michael
Image
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Post by PikkaBird »

MarkyParky wrote:According to documentation, and also accordin to GRF files I have studied so far, it should be byte value, so I use for example 01.
It's a generic text string (regardless of the feature byte), so it's a word (and because it's being used in a property, it needs to be a DCxx word, as michael posted).

Like I said before, you may also be getting problems because your string does not include the special character that OTTD is looking for in the prop 0C string of a cargo.
MarkyParky
Engineer
Engineer
Posts: 89
Joined: 20 Nov 2003 15:20

Post by MarkyParky »

To avoid sideproblems, I tried to test 09 property (name of cargo) that does not include any special characters. Then I created very simple .grf file just using examples Michael gave me here (code follows):

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 7)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
    0 * 4     03 00 00 00
    1 * 12    08 07 "DF" 02 01 "Test" 00 00
    2 * 13    04 0B 7F 01 01 DC "BLABLA" 00   
    3 * 8     00 0B 01 01 03 09 01 DC 
This code should change Oil to BLABLA. When I put it into OpenTTD and click on the rafinery , I get following error:
"!String 0xDC01 is invalid. Probably because an old version of the .lng file."

If I make the Action0 point to some already existing string, everything is working fine. So problem is probably still with Action4.
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Post by PikkaBird »

Okay, silly question time.. what version of OTTD are you using?
MarkyParky
Engineer
Engineer
Posts: 89
Joined: 20 Nov 2003 15:20

Post by MarkyParky »

Yestherdays nightly ;). But I tried older as well. Also latest GRFCodec.
User avatar
glx
OpenTTD Developer
OpenTTD Developer
Posts: 623
Joined: 02 Dec 2005 15:43
Location: Drancy(93) - France
Contact:

Post by glx »

Set bit 7 of lang-id (DCXX are "generic" strings).
MarkyParky
Engineer
Engineer
Posts: 89
Joined: 20 Nov 2003 15:20

Post by MarkyParky »

I have tried also. Same error. It starts to sound like pretty mystery ;). Can anyone try to make himself simmilar simple file, compile it and try it out?
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Post by PikkaBird »

MarkyParky wrote:Can anyone try to make himself simmilar simple file, compile it and try it out?
Okay. Set property 08 before you try to set any other properties.
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot], Mrsunman and 26 guests