NML/NFO to GRF Related problem......

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

User avatar
YNM
Tycoon
Tycoon
Posts: 3573
Joined: 22 Mar 2012 11:10
Location: West Java

NML/NFO to GRF Related problem......

Post by YNM »

Sorry, I just need an advice....

I have make a simple nml file, then I try to compile it to GRF, but this is the problem :
nmlc file not exist.png
nmlc file not exist.png (12.78 KiB) Viewed 5228 times
The fact is, the nml file is right next to it :
nml and nmlc.png
nml and nmlc.png (22.22 KiB) Viewed 5228 times
(the nml file can be said is clear and may be can used, but i just want to try it....)

Do I make something wrong / less ? I already install the phyton too.....
Last edited by YNM on 16 Aug 2012 04:16, edited 1 time in total.
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: NML to GRF Related problem......

Post by FooBar »

With that command, NML will be looking for ITEP_try.grf in the folder C:\\Users\\THINKCENTRE, as that's the folder from where you're running the command.

Either cd to the correct folder before invoking the nmlc command, or use the full path to the nml file. Note that in case of the latter your grf file will be created in C:\\Users\\THINKCENTRE

Hope that helps!
User avatar
YNM
Tycoon
Tycoon
Posts: 3573
Joined: 22 Mar 2012 11:10
Location: West Java

Re: NML to GRF Related problem......

Post by YNM »

Sorry, wrong writing....

but later, it's repeated again
Attachments
nmlc file not exist.png
nmlc file not exist.png (17.3 KiB) Viewed 5211 times
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: NML to GRF Related problem......

Post by FooBar »

Did you understand what I wrote?
From the looks of it you didn't... Please don't hesitate to tell if you don't get it, as I assumed entry-level commandline knowledge. For in case you don't have that: "cd" is not a compact disk ;) It's a command to change directory. Try cd /? to get help on the command.
User avatar
YNM
Tycoon
Tycoon
Posts: 3573
Joined: 22 Mar 2012 11:10
Location: West Java

Re: NML to GRF Related problem......

Post by YNM »

Oh... thank you....
I already see the cd /? , but i try your first sugesstion of typing the whole location....

It works now, just the lang haven't added.
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
User avatar
YNM
Tycoon
Tycoon
Posts: 3573
Joined: 22 Mar 2012 11:10
Location: West Java

Re: NML to GRF Related problem......

Post by YNM »

Sorry for continuing this thread, anyway...

Now, as I stated above, the lang or .lng files haven't added, now does anyone know how to add it, anyway?
(if it is inside the wiki, just send me the link...)
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: NML to GRF Related problem......

Post by FooBar »

nmlc --help will tell you what options are available.

If you insist on running your commands from C:\Users\THINKCENTRE, then you also have to specify the full path of the language files. It's far easier to just change directory to where you're nml file is located. Then you don't have to specify any full path in the command.

EDIT: also this: http://www.tt-wiki.net/wiki/NMLTutorial ... on#Windows
User avatar
YNM
Tycoon
Tycoon
Posts: 3573
Joined: 22 Mar 2012 11:10
Location: West Java

Re: NML to GRF Related problem......

Post by YNM »

I already do that, are there any special naming to the .lng file ?
If not, then there is must be an additional words / command...

edit : I found that one, but I still wait from the older user words...
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
User avatar
YNM
Tycoon
Tycoon
Posts: 3573
Joined: 22 Mar 2012 11:10
Location: West Java

Re: NML to GRF Related problem......

Post by YNM »

Sorry, I hope this is my last question :

I have a problem with this :

Code: Select all

visual_effect_and_powered:    visual_effect_and_powered(VISUAL_EFFECT_DIESEL, 2, DISABLE_WAGON_POWER);
Could anyone help me (again) on this ? It's should be a diesel loco.
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: NML to GRF Related problem......

Post by planetmaker »

What is your problem?
User avatar
YNM
Tycoon
Tycoon
Posts: 3573
Joined: 22 Mar 2012 11:10
Location: West Java

Re: NML to GRF Related problem......

Post by YNM »

Well, the NML says "unexpected token line n visual_effect_and_powered"
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
User avatar
Hazzard
Engineer
Engineer
Posts: 52
Joined: 14 Apr 2012 13:24
Contact:

Re: NML to GRF Related problem......

Post by Hazzard »

Maybe a missing semicolon?
User avatar
YNM
Tycoon
Tycoon
Posts: 3573
Joined: 22 Mar 2012 11:10
Location: West Java

Re: NML to GRF Related problem......

Post by YNM »

Uhh... I'm not a trained coder :(
Even, where to put it, actually ?

EDIT : Even the tutorial in wiki shows the same.... I don't know if this a nmlc error, maybe. (simmiliar things already happened several days back, but they solve themselves...)
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: NML to GRF Related problem......

Post by FooBar »

If it's a missing semicolon: at the end of the previous line most likely. If you're unsure, post the complete code block. The line you posted itself appears to be correct.

In general with coding, parse errors like "unexpected something on line x" generally mean that there's something wrong before line x if you can't find anything wrong with that line. More often than not the culprits are missing curly brackets of missing semicolons.
User avatar
YNM
Tycoon
Tycoon
Posts: 3573
Joined: 22 Mar 2012 11:10
Location: West Java

Re: NML to GRF Related problem......

Post by YNM »

Sorry for late reply....

Here's the full code :

Code: Select all

/* Define grf */
grf {
    grfid: "NML\00";
    /* GRF name and description strings are defined in the lang files */
    name: string(STR_GRF_NAME);
    desc: string(STR_GRF_DESC);
    /* This is the first version, start numbering at 0. */
    version: 0;
    min_compatible_version: 0;
}

/* Define a rail type table,
 * this allows referring to railtypes
 * irrespective of the grfs loaded.
 */
railtypetable {
    RAIL, ELRL, MONO, MGLV,
}

/* Basic template for 4 vehicle views */
template tmpl_vehicle_basic(x, y) {
    // arguments x, y: coordinates of top-left corner of first sprite
    [x,      y,  8, 24,  -3, -12] //xpos ypos xsize ysize xrel yrel
    [x +  9, y, 22, 20, -14, -12]
    [x + 32, y, 32, 16, -16, -12]
    [x + 65, y, 22, 20,  -6, -12]
}

/* Template for a vehicle with only 4 views (symmetric) */
template tmpl_vehicle_4_views(num) {
    // argument num: Index in the graphics file, assuming vertical ordering of vehicles
    tmpl_vehicle_basic(1, 1 + 32 * num)
}

/* Template for a vehicle with 8 views (non-symmetric) */
template tmpl_vehicle_8_views(num, reversed) {
    // argument num: Index in the graphics file, assuming vertical ordering of vehicles
    // argument reversed: Reverse visible orientation of vehicle, if set to 1
    tmpl_vehicle_basic(reversed ? 89 : 1, 1 + 32 * num)
    tmpl_vehicle_basic(reversed ? 1 : 89, 1 + 32 * num)
}

/* Template for a single vehicle sprite */
template tmpl_vehicle_single(num, xsize, ysize, xoff, yoff) {
    [1, 1 + 32 * num, xsize, ysize, xoff, yoff]
}

/* Define the spritesets, these allow referring to these sprites later on */
spriteset (set_icm_front_lighted, "gfx/BB series sprite") { tmpl_vehicle_8_views(0, 0) }
spriteset (set_icm_rear_lighted,  "gfx/BB series sprite") { tmpl_vehicle_8_views(1, 1) }
spriteset (set_icm_front,         "gfx/BB series sprite") { tmpl_vehicle_8_views(2, 0) }
spriteset (set_icm_rear,          "gfx/BB series sprite") { tmpl_vehicle_8_views(3, 1) }
spriteset (set_icm_middle,        "gfx/BB series sprite") { tmpl_vehicle_4_views(4)    }
spriteset (set_icm_purchase,      "gfx/BB series sprite") { tmpl_vehicle_single(5, 53, 14, -25, -10) }
spriteset (set_icm_invisible,     "gfx/BB series sprite") { tmpl_vehicle_single(6,  1,  1,   0,   0) }

/* Define the actual train */
item(FEAT_TRAINS, item_icm) {
    /* Define properties first, make sure to set all of them */
    property {
        name:                         string(STR_ICM_NAME);
        // not available in toyland:
        climates_available:           bitmask(CLIMATE_TEMPERATE, CLIMATE_ARCTIC, CLIMATE_TROPICAL); 
        introduction_date:            date(19, 1, 1);
        model_life:                   VEHICLE_NEVER_EXPIRES;
        vehicle_life:                 30;
        reliability_decay:            20;
        refittable_cargo_classes:     bitmask();
        non_refittable_cargo_classes: bitmask();
        // refitting is done via cargo classes only, no cargoes need explicit enabling/disabling:
        refittable_cargo_types:       cargo_disallow_refit; 
        // It's an intercity train, loading is relatively slow:
        loading_speed:                6; 
        cost_factor:                  45;
        running_cost_factor:          100; // Changed by callback
        sprite_id:                    SPRITE_ID_NEW_TRAIN;
        speed:                        110 km/h; // actually 140, but there are rounding errors
        misc_flags:                   bitmask(TRAIN_FLAG_2CC, TRAIN_FLAG_MU);
        refit_cost:                   0; //refit costs don't apply to subcargo display 
        // callback flags are not set manually
        track_type:                   RAIL; // from rail type table
        ai_special_flag:              AI_FLAG_PASSENGER;
        power:                        1260 kW; // Changed by CB
        running_cost_base:            RUNNING_COST_DIESEL;
        dual_headed:                  0;
        cargo_capacity:               0; // per part, changed by callback
        weight:                       75 ton; // Total, changed by callback
        ai_engine_rank:               0; // not intended to be used by the ai
        engine_class:                 ENGINE_CLASS_DIESEL;
        extra_power_per_wagon:        0 kW;
        // 4/12 of weight on driving wheels, with a default friction coefficient of 0.3:
        tractive_effort_coefficient:  0.3 / 3; // changed by callback
        air_drag_coefficient:         0.1;
        shorten_vehicle:              SHORTEN_TO_88
        // Overridden by callback to disable for non-powered wagons
        visual_effect_and_powered:    visual_effect_and_powered(VISUAL_EFFECT_DIESEL, 2, DISABLE_WAGON_POWER);
        extra_weight_per_wagon:       0 ton;
        bitmask_vehicle_info:		  0;
	}
	/* Define graphics and callbacks
     * Setting all callbacks is not needed, only define what is used */
	 graphics {
	    default:                     set_icm_front_lighted;
	}
}	
... and the .lang :

Code: Select all

##grflangid 0x01

STR_GRF_NAME                 :NML Example NewGRF: Train
STR_GRF_DESC                 :{ORANGE}NML Example NewGRF: Train{}{BLACK}This NewGRF is intended to provide a coding example for the high-level NewGRF-coding language NML.{}Original {BLACK}coding by {SILVER}DJNekkid.{}{BLACK}This NewGRF defines an Indonesian Diesel, the BB 200 .

STR_ICM_NAME                 :BB 200 (Diesel)
Well, I dont change the name :oops: but I just not understand it :(

Also, here's the graphics : (Note I just want to use the one labelled "BB 200" )
I will only use the BB 200
I will only use the BB 200
BB series sprite.png (6.33 KiB) Viewed 4882 times
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: NML to GRF Related problem......

Post by planetmaker »

As foobar said: you're missing a semicolon in the line preceeding the one which is quoted in the error:

Code: Select all

     shorten_vehicle:              SHORTEN_TO_88
 
Add one in the end of that line.
User avatar
YNM
Tycoon
Tycoon
Posts: 3573
Joined: 22 Mar 2012 11:10
Location: West Java

Re: NML to GRF Related problem......

Post by YNM »

Uhh, but it later makes another fault at these place :

Code: Select all

 refittable_cargo_types:       cargo_disallow_refit; 
It says I have to use cargo_disallow_refit at there, but I wonder how can it still wrong.

Code: Select all

shorten_vehicle:              SHORTEN_TO_88;
It says to change it to 'length' instead. I wonder how to use this anyway.
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: NML to GRF Related problem......

Post by FooBar »

Both are not errors, but reminders that things changed and that you should use the indicated replacements instead.

Length is simple: it's just a number, in fact it's the x in SHORTEN_TO_x8.

refittable_cargo_types should be a bitmask of cargo types, not an identifier of whatever you have there. Apart from that, it's recommended to not use refittable_cargo_types at all, but to use the properties cargo_allow_refit and cargo_disallow_refit instead. These require an array of cargo types instead of a bitmask, and don't require you to have the cargo types used in these properties in the first 32 positions of the cargotable.

I currently use something like this for a hopper in the Dutch trainset:

Code: Select all

refittable_cargo_classes: bitmask(CC_BULK); 
non_refittable_cargo_classes: bitmask(CC_NON_POURABLE); 
cargo_allow_refit: [PLST, PLAS]; 
cargo_disallow_refit: [FRUT, TOFF, CTCD, BDMT, WDPR];
As you can see, no refittable_cargo_types property there. I suppose the tutorial needs updating on this part.
User avatar
YNM
Tycoon
Tycoon
Posts: 3573
Joined: 22 Mar 2012 11:10
Location: West Java

Re: NML to GRF Related problem......

Post by YNM »

Thank you FooBar that now the code is not flawed....

The only thing still lying is how to take the graphics together with the code?
nmlc asking me for it... But again, It's the same like the first problem.... they don't found it.

(Even if the graphic needs the location, it says that you can't make 2 nml file in a time :( or something similiar, though.)
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: NML to GRF Related problem......

Post by FooBar »

Just put everything in one directory: nml file, nmlc program, graphics files (and the language files in a subdirectory called lang).
In your nml file, ony have the name of the graphics files, without any leading path.

Then follow these steps: http://www.tt-wiki.net/wiki/NMLTutorial ... sing_NML_3
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Semrush [Bot] and 34 guests