NML - a Newgrf Meta Language

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

Moderator: Graphics Moderators

User avatar
Greyfur
Engineer
Engineer
Posts: 36
Joined: 31 Oct 2004 12:43
Location: Slovakia - Bratislava
Contact:

Re: NML - a Newgrf Meta Language

Post by Greyfur » 07 Sep 2017 17:50

Actually the #2 is not really what I wanted to achieve.

At the end of WWII many German buses were taken by the armies and these were later distributed by the ministry of transportation. So basically what happened was that the companies got various buses as a compensation for buses that were in desolate condition (during WWII there was not enough tires and spare parts as all were sent to the armies), and as a compensation for buses taken by the German forces at the end of war for evacuation of German families, officers, etc.

So basically the company sent an order to the ministry and they got buses from a certain pool, not really able to decide what capacity, age or producer/type they will be.

I know, that several railway carriages sets have several variations of the same carriage (like several different liveries) and as you buy it will randomly pick the livery. My question was rather if this can be used on road vehicles and if yes, if it can be used to not only pick the livery, but attributes like running costs, # of passengers, top speed, loading speed, etc.
Woof !

User avatar
Greyfur
Engineer
Engineer
Posts: 36
Joined: 31 Oct 2004 12:43
Location: Slovakia - Bratislava
Contact:

Re: NML - a Newgrf Meta Language

Post by Greyfur » 07 Sep 2017 17:53

andythenorth wrote: No, the vehicle can be built, but can't be given any station orders (vehicles fitted for pax can't route to truck stations and vice versa).
So, a bus station can't load mail? As if you build a bus station next to a train station, you will have mail and passengers there. So the mail is on the station and the bus will stop at the bus station, which contains mail.
Woof !

User avatar
Leanden
Tycoon
Tycoon
Posts: 2621
Joined: 19 Mar 2009 19:25
Location: Kent

Re: NML - a Newgrf Meta Language

Post by Leanden » 07 Sep 2017 18:31

Greyfur wrote:
andythenorth wrote: No, the vehicle can be built, but can't be given any station orders (vehicles fitted for pax can't route to truck stations and vice versa).
So, a bus station can't load mail? As if you build a bus station next to a train station, you will have mail and passengers there. So the mail is on the station and the bus will stop at the bus station, which contains mail.
Yep thats Openttd 101. Buses dont stop at Truck stops and vice versa, regardless of what cargo is waiting
Image

McZapkie
Tycoon
Tycoon
Posts: 1175
Joined: 18 Jan 2014 18:10

Re: NML - a Newgrf Meta Language

Post by McZapkie » 08 Sep 2017 12:49

andythenorth wrote:
Greyfur wrote:1) Have a bus transport both passengers and mail at once?
No, the vehicle can be built, but can't be given any station orders (vehicles fitted for pax can't route to truck stations and vice versa).
:)

Of course they can, just build all scheduled stations as universal freight/passenger stops (bus stop adjacent to truck stop). I tried it many times :)
My experimental openTTD server: 149.156.194.203:3979 non-standard client, now testing: JGRPP http://tiny.pl/ggnch
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, preindustrial houses, wired, ECS industry extension, V4 CEE train set.
Addicted to freeciv longturn.

User avatar
Kaaskroket
Engineer
Engineer
Posts: 10
Joined: 14 Sep 2017 11:59

Re: NML - a Newgrf Meta Language

Post by Kaaskroket » 15 Sep 2017 09:49

hello guys,

I recently made an attempt to create my first grf file using the nml language. I am not a good programmer, but with the help of some examples from both the wiki and the forums I succeeded in creating a grf which adds a few fictional planes and other air vehicles for gameplay.

One of these planes is the Arwing from Starfox which has an maximum speed of 5130 km/h. At first I wasn't able to apply this speed to the vehicle, because the maximum speed is 3280 km/h when the property speed is set to 255. After reading several posts of the forums I figured out that this limitation can be lifted with the use of a callback. After applying this to the vehicle I however experienced a problem: due to the enormous speed, the aircraft keeps circling around an airport when trying to land even if the runway is empty.

So my question is: Is there a simple way to make the aircraft slow down when it has reached the airport of destination so that it can land?
Attachments
ezgif-4-d85d3e9185.gif
ezgif-4-d85d3e9185.gif (3.91 MiB) Viewed 3793 times

User avatar
Pyoro
Tycoon
Tycoon
Posts: 2467
Joined: 17 Oct 2008 12:17
Location: Virgo Supercluster

Re: NML - a Newgrf Meta Language

Post by Pyoro » 26 Apr 2018 12:46

I have a question about snow-awareness and animation - I'm always doing it the same way for my tiles:

Code: Select all

spritelayout spritelayout_emptytile_12 {
    ground {
        sprite: 4023; 
    }
	building {
        sprite: LOAD_TEMP(1);
		hide_sprite: (terrain_type != TILETYPE_SNOW);
    }
}
So there's the groundtile and if it's above the snowline this switch I copied from somewhere says what other groundtile to draw:

Code: Select all

switch (FEAT_OBJECTS, SELF, switch_emptytile_1_object, [
        //tile slope offset in storage register 0
        STORE_TEMP(slope_to_sprite_offset(tile_slope), 0),
        //terrain type in storage register 1
        STORE_TEMP(GROUNDSPRITE_NORMAL, 1),
		STORE_TEMP( (nearby_tile_terrain_type(0,0) == TILETYPE_DESERT) * GROUNDSPRITE_DESERT, 1),
		STORE_TEMP( LOAD_TEMP(1) + (LOAD_TEMP(1) == 0) * 4512 * (nearby_tile_terrain_type( 1, 0) == TILETYPE_DESERT), 1),
		STORE_TEMP( LOAD_TEMP(1) + (LOAD_TEMP(1) == 0) * 4512 * (nearby_tile_terrain_type(-1, 0) == TILETYPE_DESERT), 1),
		STORE_TEMP( LOAD_TEMP(1) + (LOAD_TEMP(1) == 0) * 4512 * (nearby_tile_terrain_type( 0, 1) == TILETYPE_DESERT), 1),
		STORE_TEMP( LOAD_TEMP(1) + (LOAD_TEMP(1) == 0) * 4512 * (nearby_tile_terrain_type( 0,-1) == TILETYPE_DESERT), 1),
		STORE_TEMP( LOAD_TEMP(1) + (LOAD_TEMP(1) == 0) * GROUNDSPRITE_NORMAL, 1),
		STORE_TEMP(terrain_type == TILETYPE_SNOW   ? GROUNDSPRITE_SNOW : LOAD_TEMP(1), 1),
		STORE_TEMP(snowline_height == 0xFF ? 0xFF : nearby_tile_height(0,0) - snowline_height, 255),
		STORE_TEMP((LOAD_TEMP(255) == -1) ? GROUNDSPRITE_SNOW_1_4 : LOAD_TEMP(1), 1),
		STORE_TEMP((LOAD_TEMP(255) ==  0) ? GROUNDSPRITE_SNOW_2_4 : LOAD_TEMP(1), 1),
		STORE_TEMP((LOAD_TEMP(255) ==  1) ? GROUNDSPRITE_SNOW_3_4 : LOAD_TEMP(1), 1)
        ]) {
    switch_emptytile_1_view;
}
(slope isn't actually needed here but whatever). Anyway, this works reliably, as far as I've found.

But when I do the same thing for an animated ground tile:

Code: Select all

spritelayout spritelayout_field_41 {
	ground {
		sprite: 4202 + (animation_frame * 19);
	}
	building {
		sprite: LOAD_TEMP(1);
		hide_sprite: (terrain_type != TILETYPE_SNOW);
	}
It doesn't work and instead always draws the non-snow groundtile.

However, if I just use the "simple" method:

Code: Select all

spritelayout spritelayout_field_41 {
	ground {
		sprite: 4202 + (animation_frame * 19);
	}
	building {
		sprite: GROUNDSPRITE_SNOW;
		hide_sprite: (terrain_type != TILETYPE_SNOW);
	}
and draw the snow-tile like this (disregarding the transitions) ... it does actually work again.

I've tried a bunch of variations and the results are always the same. Can't "hide" the ground sprite 'cause that causes glitches. Reversing the order of groundsprite and animated sprite doesn't help either. I might have overlooked a possible combination of groundsprites, childsprites, buildings, in various orders, but I've fiddled around quite a bit ^^;

So, basically: why does the load_temp-switch method work for non-animated ground tiles but not for animated ones? And why does it still work if the tile in question is directly given? ^^;
Or, heck, I don't care so much about the "why", and I suppose just losing the snowy transitions isn't such a big deal - but if anyone has a solution I'd still be interested (or maybe there's generally a flaw in the method that could be fixed/improved ;) ).

User avatar
Pyoro
Tycoon
Tycoon
Posts: 2467
Joined: 17 Oct 2008 12:17
Location: Virgo Supercluster

Re: NML - a Newgrf Meta Language

Post by Pyoro » 30 Apr 2018 14:52

Alright, an easier(?) question.

I thought about doing a date-aware item, and looked at VAST on how to do that with animations, but it's too incomprehensible. Basically he's made some switch that controls animations and then magic happens and it works.
So I decided to just go with what I know and simply hide sprites:

Code: Select all

building { //FRUIT
		sprite: spriteset_fruit(0);
		xoffset: 8;
		yoffset: -8;
		zoffset: 48;
		xextent: 8;
		yextent: 8;
		zextent: 8;
	}
	childsprite {
		sprite: spriteset_fruit(1);
		hide_sprite: current_month != 3;
	}
	childsprite {
		sprite: spriteset_fruit(2);
		hide_sprite: current_month != 4 && current_month != 5 && current_month != 6 && current_month != 7;
	}
	childsprite {
		sprite: spriteset_fruit(3);
		hide_sprite: current_month != 8 && current_month != 9;
	}
And that works, mostly, except that sprites don't update reliably. That never seemed to be an issue if I do the same thing for example for snow-awareness - as soon as the snow is there, the sprite updates. But here date changes and sometimes something happens and sometimes nothing does, unless I zoom in and out, then it refreshes and works properly.

I guess it has something to do with objects not being redrawn randomly all the time, to help performance or whatever, but is there anything I can do about that? Otherwise I guess I'll have to try and figure out how that animation thing actually works ^^;

Eddi
Tycoon
Tycoon
Posts: 7398
Joined: 17 Jan 2007 00:14

Re: NML - a Newgrf Meta Language

Post by Eddi » 02 May 2018 07:51

basically, you cannot rely on the sprite being redrawn at a specific time, and you cannot trigger that from your NewGRF. The game redraws the tile every 256 ticks ("tileloop"), or whenever it was invisible due to something else (like a window drawn over it, or a vehicle passing by). this works with snow-awareness, because changing snow levels is also done in the tieloop, so it's redrawn then anyway, but you cannot use "current_month" in your calculation, because that changes at different times.

what you instead could do is put your date calculation into the animation callback, and use the animation frame for drawing
You might not exactly be interested in Ferion, but if you are, have fun :)

Sunmannus
Engineer
Engineer
Posts: 18
Joined: 09 Aug 2013 06:31

Re: NML - a Newgrf Meta Language

Post by Sunmannus » 18 Sep 2018 21:31

Following the tutorial, I'm trying to make an articulated road vehicle. The vehicle and trailer appear ingame, but for some reason, the trailer sprites don't show up correctly in some views. Let me show you.
Image
That's the expected behaviour, trailer sprite appears above the truck

Image
In this case, the trailer should overlap part of the truck, but it doesn't.

Please check the code. Am I missing something?
[+] Spoiler

Code: Select all

//DEFAULT
spriteset (SpS_TRUCK, "gfx/TRUCKS.png") { TMP_32px_A (0,820) }
spriteset (SpS_TRAILER_000, "gfx/TRUCKS.png") { TMP_32px_A (0,860) }
spriteset (SpS_TRAILER_100, "gfx/TRUCKS.png") { TMP_32px_B (0,860) }

spritegroup SpG_TRAILER {
	loading: [SpS_TRAILER_000, SpS_TRAILER_100];
	loaded:  [SpS_TRAILER_000, SpS_TRAILER_100];
}
//set default gfxs
switch (FEAT_ROADVEHS, SELF, SWI_TRUCK_PartsGFx, position_in_consist ) {
    0: return SpS_TRUCK;
    1: return SpG_TRAILER; 
    return SpS_TRUCK; 
}

//set number of articulated parts
switch (FEAT_ROADVEHS, SELF, SWI_TRUCK_NumberParts, extra_callback_info1) {
    0: return ITEM_TRUCK;
	1: return ITEM_TRAILER;
    return CB_RESULT_NO_MORE_ARTICULATED_PARTS;
}
//set capacity of each part
switch (FEAT_ROADVEHS, SELF, SWI_TRUCK_PartCap, position_in_consist ) {
    0: return 0;
	1: return 30;
    return 30; //default
}
//to adjust veh length
switch (FEAT_ROADVEHS, SELF, SWI_TRUCK_Length, position_in_consist) {
    0: return 4;
    return 8;
}

item (FEAT_ROADVEHS, ITEM_TRAILER) {
    property {
		sprite_id:                      SPRITE_ID_NEW_ROADVEH;       
	    name:                           string(STR_NAME_TRAILER);
        climates_available:             NO_CLIMATE;
        refittable_cargo_classes:       bitmask(CC_PIECE_GOODS);
        non_refittable_cargo_classes:   bitmask();
		cargo_allow_refit:			    [];
		cargo_disallow_refit:			[];
		default_cargo_type:				GOOD;
        loading_speed:                  5;
        cost_factor:                    0;
        running_cost_base:              RUNNING_COST_NONE;
		running_cost_factor:            0;
		refit_cost:                     25;
		cargo_age_period:				185;
		power:                          0 hp;
        weight:                         0 ton;
		tractive_effort_coefficient:	0;
		air_drag_coefficient:			0;
		cargo_capacity:                 30;
        sound_effect:                   SOUND_TRUCK_START;
        misc_flags:                     bitmask(ROADVEH_FLAG_2CC, ROADVEH_FLAG_AUTOREFIT);
}
	graphics {
	default: SpG_TRAILER;
	}
}
item (FEAT_ROADVEHS, ITEM_TRUCK) {
    property {
		sprite_id:                      SPRITE_ID_NEW_ROADVEH;       
	    name:                           string(STR_NAME_TRUCK);
        climates_available:             ALL_CLIMATES;
        introduction_date:              date(2001,01,01);
        model_life:                     30;
        vehicle_life:                   20;
        reliability_decay:              20;
        refittable_cargo_classes:       bitmask(CC_PIECE_GOODS);
        non_refittable_cargo_classes:   bitmask();
		cargo_allow_refit:			    [];
		cargo_disallow_refit:			[];
		default_cargo_type:				GOOD;
        loading_speed:                  5;
        cost_factor:                    20;
        running_cost_base:              RUNNING_COST_ROADVEH;
		running_cost_factor:            125;
		refit_cost:                     25; // Refitting is free (25% purchase cost)
		cargo_age_period:				185;
        speed:                          98 km/h;
		power:                          480 hp;
        weight:                         15 ton;
		cargo_capacity:                 30;
        sound_effect:                   SOUND_TRUCK_START;
        misc_flags:                     bitmask(ROADVEH_FLAG_2CC, ROADVEH_FLAG_AUTOREFIT);
}
	graphics {
	default: SWI_TRUCK_PartsGFx;
	articulated_part: SWI_TRUCK_NumberParts;
	length: SWI_TRUCK_Length;
	cargo_capacity: SWI_TRUCK_PartCap;
	purchase: SpS_TRUCK_Purchase;
	additional_text: string(STR_INFO_TRUCK);
	}
}

Eddi
Tycoon
Tycoon
Posts: 7398
Joined: 17 Jan 2007 00:14

Re: NML - a Newgrf Meta Language

Post by Eddi » 18 Sep 2018 22:53

you need to be careful with overlaps, as the game has a rather primitive algorithm of using bounding boxes to decide which sprite must be drawn on top
You might not exactly be interested in Ferion, but if you are, have fun :)

User avatar
Gwyd
Chief Executive
Chief Executive
Posts: 692
Joined: 17 Apr 2017 16:52
Location: Western Ile-de-France Region

Re: NML - a Newgrf Meta Language

Post by Gwyd » 19 Sep 2018 18:13

In this case, the truck's bounding box is in front of the trailer's, so the truck is drawn on top.

User avatar
PNDA_
Engineer
Engineer
Posts: 51
Joined: 18 Jul 2018 17:26
Location: Germany

Re: NML - a Newgrf Meta Language

Post by PNDA_ » 06 Oct 2018 19:52

Hey,
This might be a slightly out of place (in the meaning of wrong thread or forum) question, but will there be any future Updates on Stations (or even any of the other missing Features (0x04, 5, 6, 7, C, E))?

I am currently looking through the code and seeing if I could help out a bit. From the wiki and in the code, I see that only the Action0 Properties are missing for Stations, same Information I get when trying to compile a NML File with an item (FEAT_STATIONS). (And I have never done anything in NFO either, though it doesnt seem to be that hard)

action0properties.py:

Code: Select all

#
# Feature 0x04 (Stations)
#

properties[0x04] = {
	'station_type'							: [{'size': 4, 'num': 0x08, 'value_function': default_station}, {'size': 4, 'num': 0x08, 'value_function': waypoint}],
	'sprite_layout'							: {'size': 5, 'num': 0x09},
	'copy_sprite_layout'					: {'size': 1, 'num': 0x0A},
	'callback_flags'						: {'size': 1, 'num': 0x0B},
	'number_of_disabled_platforms'			: {'size': 1, 'num': 0x0C},
	'number_of_disabled_platforms_length'	: {'size': 1, 'num': 0x0D},
	'custom_layout'							: {'size': 5, 'num': 0x0E},
	'copy_layout_by_station_id'				: {'size': 1, 'num': 0x0F},
	'lots_threshold'						: {'size': 2, 'num': 0x10},
	'pylon_placement'						: {'size': 1, 'num': 0x11},
	'cargo_type_sprites'					: {'size': 4, 'num': 0x12},
	'general_flags'							: {'size': 1, 'num': 0x13},
	'overhead_wire_placement'				: {'size': 1, 'num': 0x14},
	'allow_train_to_enter'					: {'size': 1, 'num': 0x15},
	'animation_info'						: {'size': 2, 'num': 0x16},
	'animation_speed'						: {'size': 1, 'num': 0x17},
	'animation_triggers'					: {'size': 2, 'num': 0x18},
	# 19 Road Routing not yet implemented
	'register_modifiers'					: {'size': 5, 'num': 0x1A},
}
global_constants.py:

Code: Select all

# Stations Callback Flags
	'AVAILABLE_CONSTRUCTION':			0,
	'':									1,
	'':									2,
	'':									3,
	'':									4,

	# Stations General Flags
	'DIFFERENT_GROUND_SPRITES':			0,
	'SIMULATE_CARGO_OVER_TILES':		1,
	'':									2,
	'CUSTOM_FOUNDATION_ON_SLOPE':		3,
	'USE_EXTENDED_FOUNDATION_ON_SLOPE':	4,

	#Stations Animation triggers
	'STATION_PART_IS_BUILT':			0,
	'NEW_CARGO_AT_STATION':				1,
	'CARGO_REMOVED_FROM_STATION':		2,
	'TRAIN_ENTERS_STATION':				3,
	'TRAIN_LEAVES_STATION':				4,
	'TRAIN_LOADS_CARGO':				5,
	'REGULAR_RELOAD':					6,

	#Stations Custom layout
	'PLAIN_PLATFORM':					0x00;
	'PLATFORM_WITH_BUILDING':			0x02;
	'PLATFORM_WITH_ROOF_LEFT':			0x04;
	'PLATFORM_WITH_ROOF_RIGHT':			0x06;
Some of this might be wrong, or not work, so any Info and Help on how to continue would be nice :D
Also it would be great if any of the Devs that already know how nml works, continue adding the missing features and I would be happy to help!
Also, I haven't quite figured out how to compile yet, if anyone could show how to that would be great!
Thanks

User avatar
Greyfur
Engineer
Engineer
Posts: 36
Joined: 31 Oct 2004 12:43
Location: Slovakia - Bratislava
Contact:

Re: NML - a Newgrf Meta Language

Post by Greyfur » 15 Oct 2018 07:09

Is it possible to do new graphics for stations in NML? The online wiki page says it is not, but it also says it has not been updated for 6 years...

Thank you!
Woof !

User avatar
Gwyd
Chief Executive
Chief Executive
Posts: 692
Joined: 17 Apr 2017 16:52
Location: Western Ile-de-France Region

Re: NML - a Newgrf Meta Language

Post by Gwyd » 15 Oct 2018 10:49

No, you cannot yet code stations with NML.

User avatar
GarryG
Tycoon
Tycoon
Posts: 2991
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: NML - a Newgrf Meta Language

Post by GarryG » 15 Oct 2018 11:51

If any one want to build stations .. can be done in NFO.

Quast65 has a tutorial in Simuscape at
http://www.simuscape.net/simutalk/viewt ... e6a57974f2

Step by step guide making platforms and station buildings both track and non-tracks.
Soot Happens
All my projects are GPLv2 License unless stated.
Auz Project Releases: viewtopic.php?f=67&t=84725
AuzTrains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
AuzObjects: viewtopic.php?f=26&t=75657
AuzBridges: viewtopic.php?f=26&t=75248
AuzStations: viewtopic.php?f=26&t=76390
AuzTracks: viewtopic.php?f=26&t=82691
AuzSubwayStations: viewtopic.php?f=26&t=85335

User avatar
Gwyd
Chief Executive
Chief Executive
Posts: 692
Joined: 17 Apr 2017 16:52
Location: Western Ile-de-France Region

Re: NML - a Newgrf Meta Language

Post by Gwyd » 15 Oct 2018 21:21

m4nfo is also a language that I have tried for coding stations and it seems to work quite well... If only I could have some help from the developer...

User avatar
PNDA_
Engineer
Engineer
Posts: 51
Joined: 18 Jul 2018 17:26
Location: Germany

Re: NML - a Newgrf Meta Language

Post by PNDA_ » 04 Dec 2018 18:40

Hey, so I am here again, trying to implement Stations into NML. Because it seems like development isn't going anywhere just now.

I have managed for the NML Compiler to ouput a file, a working GRF File, and also accept Station Properties and Callbacks. I only have a few problems with the properties so OpenTTD can actually use the file and the Stations show up ingame.
I will show the outputed NFO Code with the Errors marked by NFORenum. I also got a bit of Information on how NFO works of of the output of m4NFO.

Code: Select all

//!!Warning (209): Offset 4: Found byte 1 of a 4-byte escape while reading byte 1 of a 1-byte field.
//!!Warning (42): Length does not match nument1 and nument2 of 01 and 00. (Expected 7 bytes)
//!!Error (58): Action 2 declaring no lots-of-cargo sets.
//!!Warning (209): Offset 5: Found byte 2 of a 4-byte escape while reading byte 1 of a 2-byte field.
    5 * 18	 02 04 FF \b1 \dx80000000 
\dx80000000 \b0 \b0 \b0 \b16 \b16 \b16

//!!Fatal Error (47): Offset 7: Invalid property C5.
    6 * 13	 00 04 \b2 01 FF \wx0000 
C5 \wx0000 
08 \wx0000 

//!!Error (206): Cannot set (extended-)byte IDs for feature 04.
    7 * 15	 04 04 7F 01 00 "Station_1" 00 

//!!Error (206): Cannot set (extended-)byte IDs for feature 04.
    8 * 21	 04 04 7F 01 00 "Single Platform" 00 

//!!Error (200): Offset 3: Prop 08 has not been set for ID 00.
    9 * 7	 03 04 01 00 \b0 
\wx00FF 	// station_tile_layout; 
So sprite 5 to 9 all have some kind of Warning or Error. I just can't really get on what produces these errors and why they are happening. And what are these \wx and \dx, those are quite easy to find in the python compiler:

Code: Select all

def print_varx(self, value, size):
        """
        Print a variable sized value.

        @param value: Value to output.
        @type  value: C{int}

        @param size: Size of the output (1..4), 3 means extended byte.
        @type  size: C{int}
        """
        if size == 1:
            self.print_bytex(value)
        elif size == 2:
            self.print_wordx(value)
        elif size == 3:
            self.print_bytex(0xFF)
            self.print_wordx(value)
        elif size == 4:
            self.print_dwordx(value)
        else:
            assert False
The NML Code is very basic I would say:

Code: Select all

item (FEAT_STATIONS, i_station) {
	property {
		name: 					string(STR_STATION_TEST);
		station_class:			string(STR_STATION_CLASS);
	}
	graphics {
		default: station_tile_layout;
	}
}
and the new Internal Code of NML looks like this:

Code: Select all

properties[0x04] = {
    'name'                                   : {'size': 2, 'num': 0xC5, 'string': None},
    'station_class'                          : {'size': 2, 'num': 0x08, 'string': None},
    'sprite_layout'                          : {'size': 5, 'num': 0x09},
    'copy_sprite_layout'                     : {'size': 1, 'num': 0x0A},
    'callback_flags'                         : {'size': 1, 'num': 0x0B},
    'number_of_disabled_platforms'           : {'size': 1, 'num': 0x0C},
    'number_of_disabled_platforms_length'    : {'size': 1, 'num': 0x0D},
    'custom_layout'                          : {'size': 5, 'num': 0x0E},
    'copy_layout_by_station_id'              : {'size': 1, 'num': 0x0F},
    'lots_threshold'                         : {'size': 2, 'num': 0x10},
    'pylon_placement'                        : {'size': 1, 'num': 0x11},
    'cargo_type_sprites'                     : {'size': 4, 'num': 0x12},
    'general_flags'                          : {'size': 1, 'num': 0x13},
    'overhead_wire_placement'                : {'size': 1, 'num': 0x14},
    'allow_train_to_enter'                   : {'size': 1, 'num': 0x15},
    'animation_info'                         : {'size': 2, 'num': 0x16},
    'animation_speed'                        : {'size': 1, 'num': 0x17},
    'animation_triggers'                     : {'size': 2, 'num': 0x18},
    # 19 Road Routing not yet implemented
    'register_modifiers'                     : {'size': 5, 'num': 0x1A},
}
(I left out the global constants because those are irrelevant, I think.)
If anyone sees an Issue please report, and I probably have more than one mistake in the properties[0x04] = {} part.
Image

Eddi
Tycoon
Tycoon
Posts: 7398
Joined: 17 Jan 2007 00:14

Re: NML - a Newgrf Meta Language

Post by Eddi » 04 Dec 2018 22:59

so, let's go backwards, as far as i understand stuff:
  • property 08 is a 4 byte-ID (like GRF-ID, Cargo-Label, etc.), not a String
  • where did you get 0xC5 from for "name"? couldn't find that anywhere
  • the two action4 complain that you're using language ID 7F (indicating byte-IDs) instead of FF (indicating word-IDs). what that means i have no clue.
  • the action0 complains about C5 being unknown (see previous question)
  • the action2 is completely ill-formed. as far as i understand stations, tile layout should be a property (action0), not "graphics" (action2). no clue what you were trying to achieve there
You might not exactly be interested in Ferion, but if you are, have fun :)

User avatar
Gwyd
Chief Executive
Chief Executive
Posts: 692
Joined: 17 Apr 2017 16:52
Location: Western Ile-de-France Region

Re: NML - a Newgrf Meta Language

Post by Gwyd » 05 Dec 2018 06:29

In my limited knowledge on NFO, I know for sure that sprite layout goes into Action 0, but tile layout of multi tile stations gets defined in Action 2.

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

Re: NML - a Newgrf Meta Language

Post by planetmaker » 05 Dec 2018 11:26

PNDA_ wrote:Hey,
This might be a slightly out of place (in the meaning of wrong thread or forum) question, but will there be any future Updates on Stations (or even any of the other missing Features (0x04, 5, 6, 7, C, E))?
Yes. But as you have figured, it is mostly a lack of developer time. So contributions to add these missing stuff are greatly appreciated.

Do you happen to have a WIP git repo for your station code?

Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 1 guest