NML - a Newgrf Meta Language

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

Moderator: Graphics Moderators

Post Reply
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: NML - a Newgrf Meta Language

Post by Yexo »

That is not possible because as planetmaker said the correct id depends on the current climate and/or loaded industry newgrf. Slot 0x0A for example can be Valuables/Gold/Diamonds, Plastic or Milk.
BillSargent
Engineer
Engineer
Posts: 49
Joined: 09 Oct 2010 13:45
Location: Göteborg, Sweden

Re: NML - a Newgrf Meta Language

Post by BillSargent »

Yexo wrote:That is not possible because as planetmaker said the correct id depends on the current climate and/or loaded industry newgrf. Slot 0x0A for example can be Valuables/Gold/Diamonds, Plastic or Milk.

Well at any rate, it worked. And I'm learning a little more each day now.

Bill
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: NML - a Newgrf Meta Language

Post by Yexo »

Thanks to Ammler there is now a windows binary being build every night. You can download it (along with a .tar.gz of the source) here: http://bundles.openttdcoop.org/nml/nightlies/LATEST/
BillSargent
Engineer
Engineer
Posts: 49
Joined: 09 Oct 2010 13:45
Location: Göteborg, Sweden

Re: NML - a Newgrf Meta Language

Post by BillSargent »

Yexo wrote:Thanks to Ammler there is now a windows binary being build every night. You can download it (along with a .tar.gz of the source) here: http://bundles.openttdcoop.org/nml/nightlies/LATEST/
Is this being built with py2exe or something better?

Bill
User avatar
Ammler
President
President
Posts: 953
Joined: 18 Jun 2006 18:18
Location: Switzerland
Contact:

Re: NML - a Newgrf Meta Language

Post by Ammler »

we are using cxfreeze with wine


Did actually someone test this already, I got an error with images: http://dev.openttdcoop.org/issues/2351#note-7

would be nice to get feedback, if nmlc.exe is actually working :-)

Edit: nmlc.exe doesn't support pcx images..
Last edited by Ammler on 24 Mar 2011 13:39, edited 1 time in total.
Nickel_Plate
Traffic Manager
Traffic Manager
Posts: 146
Joined: 27 Dec 2004 19:37
Location: Home of the Big Cat

Re: NML - a Newgrf Meta Language

Post by Nickel_Plate »

Have installed windows binary and python27.

So do i use python shell to write file or notepad.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: NML - a Newgrf Meta Language

Post by planetmaker »

You use a (plain) text editor of your choice to write nml files. They should be utf-8 encoded.
Nickel_Plate
Traffic Manager
Traffic Manager
Posts: 146
Joined: 27 Dec 2004 19:37
Location: Home of the Big Cat

Re: NML - a Newgrf Meta Language

Post by Nickel_Plate »

Have test file see below

________________________________________________________
grf {
grfid : "NP\01\01";
name : string(STR_GRF_NAME);
desc : string(STR_GRF_DESCRIPTION);
version : 1;
min_compatible_version : 1;
}
item (FEAT_TRAINS, Lev1 'Leviathan' (Electric), 84) {
property {
sprite_id : 84;
introduction_date date(1920,01,01);
vehicle_life 6;
model_life 12;
speed 96 km/h;
power 1000;
weight 160;
cost 20;
}
}
_________________________________________________________

When trying to compile get this error.

___________________________________________
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Cyril>F:

F:\>cd\NML_r1298

F:\NML_r1298>nmlc --grf Maglav1920.grf Maglav1920.nml
nmlc: Default language file "lang\english.lng" doesn't exist

F:\NML_r1298>
________________________________________________
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: NML - a Newgrf Meta Language

Post by Terkhen »

Have you tried to do what the error itself suggests?
Nickel_Plate
Traffic Manager
Traffic Manager
Posts: 146
Joined: 27 Dec 2004 19:37
Location: Home of the Big Cat

Re: NML - a Newgrf Meta Language

Post by Nickel_Plate »

There is no Lang dir in either python or windows binary so is this something i have to create,
if so were should it be, or should it have been installed with python or windows binary.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: NML - a Newgrf Meta Language

Post by Alberth »

User avatar
Emperor Jake
Tycoon
Tycoon
Posts: 3427
Joined: 24 Apr 2007 09:37
Skype: Discord: Emperor Jake #4106
Location: Not Actually Japan
Contact:

Re: NML - a Newgrf Meta Language

Post by Emperor Jake »

I'm trying to make a railtype GRF, and I would like to use the default monorail track graphics. This is what I have so far - the track works properly, the catenary is shown, but the track itself shows up as the normal rail.

Code: Select all


item(FEAT_RAILTYPES) {
    property {
        label:                      "VACT";
        name:                       string(STR_VAC_RAIL);
        menu_text:                  string(STR_VAC_RAIL);
        build_window_caption:       string(STR_BUILD_CAPTION);
        autoreplace_text:           string(STR_AUTOREPLACE);
        new_engine_text:            string(STR_NEW_ENGINE);
        compatible_railtype_list:    ["VACT"];          
//      powered_railtype_list:      ["VACT"];                 
        railtype_flags:             bitmask(RAILTYPE_FLAG_CATENARY, RAILTYPE_FLAG_NO_LEVEL_CROSSING);
        curve_speed_multiplier:     10;
        station_graphics:           RAILTYPE_STATION_MONORAIL;          
        construction_cost:          256;                               
        speed_limit:                0 km/h;
        acceleration_model:         ACC_MODEL_MAGLEV;                   
    }
    graphics {
	CATENARY_WIRE:   wire_group_top;
	CATENARY_PYLONS: pylons_group_top;
    }
}
Thanks,
Jake
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: NML - a Newgrf Meta Language

Post by planetmaker »

I'm afraid that you'll really have to provide the graphics for the tracks yourself. You need to provide graphics for all those elements which are indicated by a * in the available graphics block list on http://hg.openttdcoop.org/nml/raw-file/ ... types.html - thus underlay, overlay, tunnels and level crossings; it is not possible to reference the base set sprites for this purpose, those sprite types simply don't exist there.

That said, I'd highly welcome if someone did the actual work to convert the existing tracks (also) into a railtype; it'll mean to probably do a bit colour-select cut and paste of the existing tracks sprites - which is certainly feasible; but if you want the existing monorail as railtype there's little way around that. But as OpenGFX' sprites are under GPL license you could go right ahead with this task :-) provided you're ready to also release your grf under GPL (i.e. attribution and publish the nml, pngs and lng files with each release)

Cheers,
pm
User avatar
Emperor Jake
Tycoon
Tycoon
Posts: 3427
Joined: 24 Apr 2007 09:37
Skype: Discord: Emperor Jake #4106
Location: Not Actually Japan
Contact:

Re: NML - a Newgrf Meta Language

Post by Emperor Jake »

Okay, thanks for that :) I release everything I make as GPL anyway.
User avatar
lawton27
Tycoon
Tycoon
Posts: 1418
Joined: 03 Aug 2009 14:29
Location: Manchester

Re: NML - a Newgrf Meta Language

Post by lawton27 »

Hi there I'm having problems setting up my nml compiler, I'm running windows 7 64 bit with python 2.7.1, I followed the instructions specified in the documentation, when I run --version I get the flowing response:
nmlVersion.png
nmlVersion.png (63.13 KiB) Viewed 2407 times
However when I attempt to use the following batch file to compile the vacTrain set as a test:

Code: Select all

@Echo off

nmlc.exe --nfo vactrain.nfo --grf vactrain.grf vactrain.nml

pause

ECHO Done!
I get this error:
nmlc error.png
nmlc error.png (112.79 KiB) Viewed 2407 times
Thanks for any help you can offer,

Lawton27
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: NML - a Newgrf Meta Language

Post by planetmaker »

It will be nice, if you could attach all the files which make up the grf (nml, graphics and language files with their respecive folders), you found a bug in NML. Please try also a more recent version, e.g. the nightly one is found here: http://bundles.openttdcoop.org/nml/nightlies/LATEST/ (you want the windows zip). I'm not sure, maybe it's fixed there, your version of NML is quite old (more than two months).

One guess is that it's a hickup with (missing or wrong) capitalization of file names of one of the graphics files you include.

You also have unreferenced code sections, that's what the first two lines with the warnings are about.
User avatar
lawton27
Tycoon
Tycoon
Posts: 1418
Joined: 03 Aug 2009 14:29
Location: Manchester

Re: NML - a Newgrf Meta Language

Post by lawton27 »

I don't know why I'm getting this problem I'm using the vacTrain newGrf source as a test, so you can download that from the first post in this thread: http://www.tt-forums.net/viewtopic.php?f=67&t=53743

Using the latest nightly I get the same error except it states the nml version as unknown and by re downloading the source I managed to get rid of the first 2 errors, I must have accidentally changed something there...

Thanks,

Lawton27
User avatar
Emperor Jake
Tycoon
Tycoon
Posts: 3427
Joined: 24 Apr 2007 09:37
Skype: Discord: Emperor Jake #4106
Location: Not Actually Japan
Contact:

Re: NML - a Newgrf Meta Language

Post by Emperor Jake »

No, that was because ou had an old version of th vactrain source :wink: That error was fixed.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: NML - a Newgrf Meta Language

Post by planetmaker »

lawton27 wrote:I don't know why I'm getting this problem I'm using the vacTrain newGrf source as a test, so you can download that from the first post in this thread: http://www.tt-forums.net/viewtopic.php?f=67&t=53743

Using the latest nightly I get the same error except it states the nml version as unknown and by re downloading the source I managed to get rid of the first 2 errors, I must have accidentally changed something there...

Thanks,

Lawton27
Hm, I can't reproduce that with NML r1301 or r1307. When I use the vactrain.nml I do get a

Code: Select all

nmlc: Image file "vactrain/sprites/local1.pcx": File doesn't exist
which is solved when I replace all "vactrain/" by nothing and then it compiles for me without error.

What do you mean with "it states the nml version as unknown"?
User avatar
Ammler
President
President
Posts: 953
Joined: 18 Jun 2006 18:18
Location: Switzerland
Contact:

Re: NML - a Newgrf Meta Language

Post by Ammler »

be also aware that nmlc.exe doesn't work with pcx
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 22 guests