GRF Separators - Build them at your taste! OTTD

Find and discuss all the latest NewGRF releases for TTDPatch and OpenTTD here.

Moderator: Graphics Moderators

Post Reply
User avatar
Digitalfox
Chief Executive
Chief Executive
Posts: 708
Joined: 28 Oct 2004 04:42
Location: Catch the Fox if you can... Almost 20 years and counting!

GRF Separators - Build them at your taste! OTTD

Post by Digitalfox »

Hello :D

I've been using NML Category System ( https://www.tt-forums.net/viewtopic.php?f=67&t=65598 ) by NekoMaster for a while now.

But like many OpenTTD users, I have my own requirements and ideas for text on the Separators. And so now I'm going to explain how to make your own Separators and not being limited by my or other creators personal taste or native language.

You can download the ones I use at the end of this post or keep reading and learn to create them.


So here are my Separators for the NewGRF Settings Window on OpenTTD.


Image


They are really easy to create and edit at your own taste.

First you need a copy of NML. NML is a NewGRF Meta Language, in short, a way of creating GRF files or also know as NewGRF files.

Download from here https://bundles.openttdcoop.org/nml/releases/LATEST/ nml-0.3.1-windows-win32.zip or a newer version when available, like nml-0.4.0-windows-win32.zip.

Extract to a folder, let's call it NML folder, like c:\NML.

Next download the source code for the separators on the next attachment:
Separators.zip
Separators Source
(854 Bytes) Downloaded 155 times
After opening you can see it's just 2 files and a folder, no complex file and/or folder system.

Extract those two files and folder to the folder NML. So it looks like this. c:\NML\Separators.nml and c:\NML\lang\english.lng. Unless you know what you're doing, don't change the path and name of files or folders I give you in this example, to avoid errors.

Now let's start by opening Separators.nml on Notepad or Wordpad or any other text editor you use.

Code: Select all

grf {
	grfid : "DF12";
	name : string(STR_GRF_NAME);
	desc : string(STR_GRF_DESCRIPTION);
	url  : string(STR_GRF_URL);     	
	version: 1;
	min_compatible_version: 1;
}
Here you just need to change the value DF12 to DF11 or DF13, or whatever number you like. Why is this needed? Well GRF's files are like car plates, you need for each one a different identification number. You don't "legally" see 2 cars with the same plate number do you? :) This means each GRF Separator must have it's own number or OpenTTD will complain.

Save the file after changing the number. Done on this file, not that hard was it? :) Don't' change anything else unless you know what you're doing!

Next, go to folder lang, and open english.lng. Again any text editing app will work.

What's in there? Have a look:

Code: Select all

##grflangid 0x01

STR_GRF_NAME   :{WHITE}[i] {BLUE}========== {WHITE}MISCELLANEOUS{BLUE} ========={WHITE} [i]

STR_GRF_DESCRIPTION :{}{WHITE}Separator for NewGRF Settings Window.{}{}By {ORANGE}Digital{GREEN}Fox{SILVER}{COPYRIGHT}{}{}{WHITE}Click the button {BLACK}"Visit website" {WHITE}on the bottom if you have any questions or doubts about this GRF.

STR_GRF_URL   :https://www.tt-forums.net/viewtopic.php?f=67&t=70779
Here the only thing you need to change is the STR_GRF_NAME line, the other two lines are optional, but do know what you're doing if you change them to avoid errors.

So as you can see in this example, the name of the Separator is "MISCELLANEOUS" it's written after {WHITE}(that's right, you might already guessed, WHITE is the color of the text), you can change that to say for example "Mining Trucks" and will look like this:

Code: Select all

STR_GRF_NAME        :{WHITE}[i] {BLUE}========== {WHITE}MINING TRUCKS{BLUE} ========={WHITE} [i]
While the name of the file is english.lng, you can use any words you like, for example in my language, the word "Trains" is "Comboios":

Code: Select all

STR_GRF_NAME        :{WHITE}[i] {BLUE}========== {WHITE}COMBOIOS{BLUE} ========={WHITE} [i]
See? Easy, right? Yes, do remember do add or remove the caracter "=" on both sides if you wish to center the text on NewGRF Setting Window.

So now we have our code ready.

What's next? Create a GRF file for this Separator.

I usually open a Command Prompt (CMD.exe) by going to Windows Start Menu and using "RUN" -> CMD

A black box will appear, where you should type the command cd\ and press enter. Next type cd nml.

The command to generate the GRF file is

Code: Select all

nmlc --grf Separator_Mining_Trucks.grf Separator.nml
Separator_Mining_Trucks.grf is the name of the GRF Separator and you can change it, for example to Separator_Comboios.grf.

Code: Select all

nmlc --grf Separator_Comboios.grf Separator.nml
Now your GRF Separator is created. If you're not going to create anymore GRF Separators close the Command Prompt (Black box :)).

Go to Windows Explorer or now called File Explorer at c:\NML and move the Separator_Mining_Trucks.grf file to your OpenTTD\NewGRF folder.

When you open OpenTTD app and go to NewGRF Settings Windows your new Separator will there waiting for you, just choose it and press the button "Add".

More information on text colors available and icons, like the train you see in my Screenshot, go here https://newgrf-specs.tt-wiki.net/wiki/NML:Language_files read everything and you'll see it's easy to change the colors and add the vehicles icons :)

Final note, my OpenTTD NewGRF Window Settings in regards to Font type, Size and the use of Anti-aliasing, are probably different from yours, so the text will look different on your screen.

My OpenTTD.cfg settings:
small_font = Tahoma Bold
medium_font = Tahoma Bold
large_font = Arial

small_size = 13
medium_size = 15
large_size = 18

small_aa = true
medium_aa = true
large_aa = true
GRF_Separators.tar
GRF Separators 1.0
(13 KiB) Downloaded 166 times
Attachments
GRF Separators
GRF Separators
GRF Separators.png (106.94 KiB) Viewed 586 times
Last edited by Digitalfox on 23 Jun 2014 12:42, edited 16 times in total.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: NewGRF Separators - Build them at your taste! OTTD

Post by planetmaker »

The original grf, as well as its concept and idea is by DJNekkid. You find the old version of those e.g. in the #openttdcoop legacy grf package
User avatar
Digitalfox
Chief Executive
Chief Executive
Posts: 708
Joined: 28 Oct 2004 04:42
Location: Catch the Fox if you can... Almost 20 years and counting!

Re: NewGRF Separators - Build them at your taste! OTTD

Post by Digitalfox »

planetmaker wrote:The original grf, as well as its concept and idea is by DJNekkid. You find the old version of those e.g. in the #openttdcoop legacy grf package
Ok, thank you, point taken :)
User avatar
Digitalfox
Chief Executive
Chief Executive
Posts: 708
Joined: 28 Oct 2004 04:42
Location: Catch the Fox if you can... Almost 20 years and counting!

Re: GRF Separators - Build them at your taste! OTTD

Post by Digitalfox »

Done and TAR file available :D
Post Reply

Return to “Graphics Releases”

Who is online

Users browsing this forum: No registered users and 39 guests