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: 3574
Joined: 22 Mar 2012 11:10
Location: West Java

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

Post by YNM »

I already tried for a twelve times to do that.... :|

Heck, the same and the same and the same again..... :?

"nmlc: error: Error: only a single nml file can be read per run" :x

That's what the (Heck!) Command Prompt always says. :evil:

(Sorry too for always asking about this, I just want to learn.... :oops: )
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 »

Sadly you fail to actually document for us what you try, so all we can do is (again) only speculate.

Don't use filenames with spaces.

Also when it may seem obvious to you, please *always* when reporting issues:
a) State your goal (kinda clear here)
b) describe what you did *exactly* (not clear at all. "I followed the tutorial" is never a description. Document exactly what you do.
c) report what output you got *exactly* (is it a full quote you give us here?)
d) tell what you expected instead (kinda clear)

for command line programmes this includes quoting verbatim of what you typed
In any case exactly quote what output you got (never paraphrase it or 'quote' approximately). Use a screenshot, if you cannot copy&paste.
User avatar
YNM
Tycoon
Tycoon
Posts: 3574
Joined: 22 Mar 2012 11:10
Location: West Java

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

Post by YNM »

Well, the code at the page before this is the full code / quote, purely.
Now it's already changed by fixing the typos, as well as following your assistance. :wink:
(I can't post the code now, I no longer on computer)

At last, the only problem saw by me is the graphics pallete... maybe an artist can solve it.
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 »

In this case I suspect a problem with the command you put in the command prompt window. It would help if you could post that; this is what planetmaker meant with "exactly".

It's easier if you copy/paste the command instead of a printscreen. In that case I can easily provide you with a correct one if it doesn't work. In case of the printscreen, I really cannot be bothered to type that over :D
User avatar
YNM
Tycoon
Tycoon
Posts: 3574
Joined: 22 Mar 2012 11:10
Location: West Java

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

Post by YNM »

Just see the code a page back, the spritesets directory "gfx/BB series sprite" but in my latest version, I removed the "gfx/" because I think it should be used when the sprite is stored in gfx file...

later then, it says that nmlc can't decide the palette, even the ANY palette....

may you see the template to teach me how to exactly use it..... or suggesting for the draws....

btw, I will try later with filename without space but underscore... (Its nearing 12 am here, good night...)
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 »

Code: Select all

"gfx/BB series sprite"
In that bit, you appear to be missing the file extension. Assuming your graphic files have one of course! Windows hides those by default, just so you know. But even then you have to supply them in your nml file. And while you're at it, indeed get rid of the spaces.

About "gfx" you're right, you only need that if your sprites are in a gfx folder (relative to the nml file).

As for the palette, there's no "any" palette. It's either the dos palette or the windows palette. Use the dos one if you're not sure. Here's how to apply it to your graphics file: http://www.tt-wiki.net/wiki/Save_paletted_image_files
User avatar
YNM
Tycoon
Tycoon
Posts: 3574
Joined: 22 Mar 2012 11:10
Location: West Java

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

Post by YNM »

The ANY palette was described in nmlc option -p or --palette=

Well, for the paletted images itself, does anyone have a palette for MS Paint ? I was have the Photoshop Cs 3, but I lost the cd :cry:

Or, is GIMP is freeware ? If not, can't talk anymore... someone has to convert the graphics in Photoshop or GIMP for me :(

addition : the current 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, help me on correcting this */
template tmpl_vehicle_basic(x, y) {
    // arguments x, y: coordinates of top-left corner of first sprite
    [x,      y, 10, 26,  -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, "BB series sprite.png") { tmpl_vehicle_8_views(0, 0) }
spriteset (set_icm_rear_lighted,  "BB series sprite.png") { tmpl_vehicle_8_views(1, 1) }
spriteset (set_icm_front,         "BB series sprite.png") { tmpl_vehicle_8_views(2, 0) }
spriteset (set_icm_rear,          "BB series sprite.png") { tmpl_vehicle_8_views(3, 1) }
spriteset (set_icm_middle,        "BB series sprite.png") { tmpl_vehicle_4_views(4)    }
spriteset (set_icm_purchase,      "BB series sprite.png") { tmpl_vehicle_single(5, 53, 14, -25, -10) }
spriteset (set_icm_invisible,     "BB series sprite.png") { 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:
        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;
        length:                       VEHICLE_LENGTH;
        // 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;
	}
}	
... the command I usually use to run it :

Code: Select all

D:\New folder>nmlc -c --grf ITP_try.grf ITP_try.nml
and the latest graphic (no changes, just to make you easier to see it)
Attachments
I have moved the sprites closer on BB 200
I have moved the sprites closer on BB 200
BB series sprite.png (6.73 KiB) Viewed 3310 times
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
Eddi
Tycoon
Tycoon
Posts: 8271
Joined: 17 Jan 2007 00:14

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

Post by Eddi »

yes, GIMP is free. get it on www.gimp.org
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 »

Yoursnotmine wrote:The ANY palette was described in nmlc option -p or --palette=
Oh that. Well, that means that NML will determine the palette for the grf for you. It'll use the Windows palette if all your graphics files are in the Windows palette, or the DOS one in all other cases. Your graphics files still need to be in one of those two palettes though.
Yoursnotmine wrote:Well, for the paletted images itself, does anyone have a palette for MS Paint ?
Paint doesn't understand palettes, so no ;)
It's fine to draw in paint, but you need an additional program to apply the palette.
Yoursnotmine wrote:the command I usually use to run it
I would avoid spaces in any folder or file name. But apart from that the command is fine.
User avatar
YNM
Tycoon
Tycoon
Posts: 3574
Joined: 22 Mar 2012 11:10
Location: West Java

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

Post by YNM »

I already paletted it, but nmlc says "Invalid palette; does not contain 256 entries" ,

How is the way straight out from this ?

EDIT : sorry, this is the paletted graphics (done it as in the palette tutorial) :
Attachments
TTD - paletted.
TTD - paletted.
BB series sprite.png (3.33 KiB) Viewed 3254 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 »

It's certainly paletted, but the palette applied to that image is certainly not one of the two TTD palettes.

Are you sure you did this step?
Make sure to uncheck Remove unused colors from colormap.
User avatar
YNM
Tycoon
Tycoon
Posts: 3574
Joined: 22 Mar 2012 11:10
Location: West Java

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

Post by YNM »

At last.... :o

Yes !! :)

It is finished !!! :D

But... :|

Heck, it says an internal error occured : :shock:

Code: Select all

Error: "The _imaging c module is not installed".
Does anyone know what is the cause of this ?
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 »

Either _imaging.pyd is missing, or the build of the nml program is broken.

The latest nml nightly (r1886) works here on Windows, so if you have any other version you can give that a try.
User avatar
YNM
Tycoon
Tycoon
Posts: 3574
Joined: 22 Mar 2012 11:10
Location: West Java

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

Post by YNM »

Does the imaging.pyd and/or other files (eg. haslib.pyd, etc.)that can be extracted from nml download .rar have to be in the same folder?

If yes, then thats my fault... and thats mean my grf is completed. :wink:
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 »

Yes, either next to nmlc.exe or somewhere in the search path of the operating system, as explained in the NML tutorial ;)
User avatar
YNM
Tycoon
Tycoon
Posts: 3574
Joined: 22 Mar 2012 11:10
Location: West Java

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

Post by YNM »

Thank you FooBar, planetmaker, and Eddi !
Now the grf is complete !
ITP_try.grf
(1.92 KiB) Downloaded 78 times
It's just the graphics still not placed right... I will try to do that myself.

And a simple last question : for multi-object, eg. a combination of engines and carriages, how to put them on ?
Especially with those brackets ; I don't want to make them wrong.
this brackets { } I mean.
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 »

As in a multiple unit or something? Just follow the NML tutorial; it explains that. If you don't get something from the tutorial, feel free to ask though!

In general you need the articulated vehicle callback to make the vehicle ... articulated.
And a switch block to decide the graphics for each part depending on the position_in_vehid_chain variable.
User avatar
YNM
Tycoon
Tycoon
Posts: 3574
Joined: 22 Mar 2012 11:10
Location: West Java

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

Post by YNM »

Oh, sorry, I use the wrong words...

I mean, If I want to make eg. complex trainset with several engines, several coaches, and several car, how to put the template and the vehicle definition ?

For articulated, how to make a vehicle, but still able to carry wagons in the middle of them (push - pull engine, for short) ?
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
Eddi
Tycoon
Tycoon
Posts: 8271
Joined: 17 Jan 2007 00:14

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

Post by Eddi »

each vehicle goes into one "item {}" block. just line them up after each other.
User avatar
YNM
Tycoon
Tycoon
Posts: 3574
Joined: 22 Mar 2012 11:10
Location: West Java

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

Post by YNM »

Firstly, sorry for restarting the topic...

Well, I have decided to code again... This time, the templates are just right. Only offset need to be repaired.

Starting the more-than-one-vehicle GRF, I choose to copy the first block (Including templates and items) and modify them a little bit (Eg. x,y coordinate, location, item name, strings, etc....)

The problem is that nmlc says that the code isn't UTF-8 coded, through I already blocked all the code and convert them to UTF-8 in Notepad ++ :
UTF-8 Problem.png
UTF-8 Problem.png (43.07 KiB) Viewed 513 times
then nmlc says this :
UTF-8 nmlc screen.png
UTF-8 nmlc screen.png (19.85 KiB) Viewed 2993 times

At last, here's the full code to be checked if there any fault inside.
ITP_try.nml
(8.95 KiB) Downloaded 75 times
(Too long if I copied all of them)

Any comments, help and suggestion will be appreciated.
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 49 guests