Editing .lng files

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

Post Reply
Rocketz
Engineer
Engineer
Posts: 4
Joined: 21 Oct 2008 15:46

Editing .lng files

Post by Rocketz »

Hey i'm new!
Since you can't save your custom vehicle names in OTTD i wanted to change them in the .lng file. How can you edit them? which tools are needed?
Yeah i know there's an original vehicle name.lng file but it's in english and i'd like to have german language with the real vehicle names. ;)
I'd also like to use the original models instead of sets. Can anyone help me with this?
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: Editing .lng files

Post by Gremnon »

You can't actually change the .lng files, but if you get the source instead of a precompiled, you can edit the .txt files that get turned into the .lng ones.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Editing .lng files

Post by DaleStan »

Or you can create a GRF; then you don't have to keep updating it and/or make sure it never gets overwritten.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Rocketz
Engineer
Engineer
Posts: 4
Joined: 21 Oct 2008 15:46

Re: Editing .lng files

Post by Rocketz »

thx for your answers...but what's the easiest way to create a grf just for vehicle names? all that grf stuff looks complicated just for changing names.
thought that grf was for graphics only 8o
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Editing .lng files

Post by DaleStan »

Rocketz wrote:thx for your answers...but what's the easiest way to create a grf just for vehicle names?
Same way you'd create any other GRF. Read the tutorial, read the relevant spec pages, download grfcodec and nforenum, open Notepad, and go for it.

Not necessarily in that order, though.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Rocketz
Engineer
Engineer
Posts: 4
Joined: 21 Oct 2008 15:46

Re: Editing .lng files

Post by Rocketz »

unfortunately the "nameyourvehicle" tutorial isn't ready yet :(
isn't there an easy way like creating a txt file:
[VehicleID] [VehicleName]
00 Train1
01 Train2

then some nice tool with which you can select the txt file and convert it to .grf or something.
or does anyone know if the save custom vehicle name feature will be fixed in the next ottd version?
LordAzamath
Tycoon
Tycoon
Posts: 1656
Joined: 08 Jun 2007 08:00

Re: Editing .lng files

Post by LordAzamath »

It can't be fixed because the saving of custom vehicle names is not implemented.. :P
The buttons that give that option are only for legacy I guess.. Anyway, it's pretty easy to do it via newGRF.
TTDPatch wiki, Action4 wrote: <Sprite-number> * <Length> 04 <feature> <language-id> <num-ent> <offset> <text>
So for a SH '30', it would be

Code: Select all

-1 * 00 04 00 7f 01 17 "My new awesome train" 
-1 is the sprite number.. Renum will put it correct..
* shows that it's a pseudosprite
00 shows the count of bytes in the sprite.. it's actually a lot more, but Renum will fix that too
04 shows that it's Action4
00 shows that the it's changing a train name
7f shows that it changes the name for all languages. Unless you want to make it language specific, I think it's good to use 7f.. Not sure
01 means that we want to change only one string.
17 is the ID of the train so it knows what to substitute
and the last one is the string itself..
@DaleStan, Does the string need 00 added too to end? And if I made some mistakes explaining, please correct them :P Or anyone else :P
PS: And I stopped the propaganda to support Dave Worley since he got a nice new red hat now.[/color]
I know I have a BBCode error in my signature but I really cba to fix it.
Eddi
Tycoon
Tycoon
Posts: 8267
Joined: 17 Jan 2007 00:14

Re: Editing .lng files

Post by Eddi »

i would assume the 00 is missing at the end.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Editing .lng files

Post by DaleStan »

LordAzamath wrote:@DaleStan, Does the string need 00 added too to end?
What does NFORenum say?
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
LordAzamath
Tycoon
Tycoon
Posts: 1656
Joined: 08 Jun 2007 08:00

Re: Editing .lng files

Post by LordAzamath »

I just pulled it out of TTDP wiki and a bit from my memories.. Don't even have any [*]TTD[*] installed atm. Nor I had any renum downloaded..
Generally I could of just got them too, but I really don't think I'd do any coding in next few months (even not lua scripting), so I just wrote what I knew without making too big investments into backing it up.
PS: And I stopped the propaganda to support Dave Worley since he got a nice new red hat now.[/color]
I know I have a BBCode error in my signature but I really cba to fix it.
Rocketz
Engineer
Engineer
Posts: 4
Joined: 21 Oct 2008 15:46

Re: Editing .lng files

Post by Rocketz »

:bow: ty very much it worked

i just had to add
0 * 4 0D 00 00 00
1 * 8 08 06 "TW" 03 05 00 00

in the nfo file also to be able to activate the .grf i hope no graphics will be messed up using the first line...but it doesn't work without it

now i just have to change the names :P
Eddi
Tycoon
Tycoon
Posts: 8267
Joined: 17 Jan 2007 00:14

Re: Editing .lng files

Post by Eddi »

the first line tells how many lines you have in your NFO file (you can leave that on 00 00 00 00 and grfcodec will tell you what it thinks it should add there), in the second line you can give a name and a description for your grf. none of these "mess up" anything
mohomed imam
Engineer
Engineer
Posts: 2
Joined: 27 Jan 2021 13:33

Re: Editing .lng files

Post by mohomed imam »

I want to create a lang file in my mother language and generate to the game. is there have any ways to do it? pls
User avatar
jfs
Tycoon
Tycoon
Posts: 1758
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: Editing .lng files

Post by jfs »

mohomed imam wrote: 24 Jan 2022 07:51 I want to create a lang file in my mother language and generate to the game. is there have any ways to do it? pls
Please see this thread: viewtopic.php?t=86894

Short answer: It's a lot of work starting a new language translation up. It can be done, but on your own it's hard.
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 27 guests