![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
NML - a Newgrf Meta Language
Moderator: Graphics Moderators
-
- Tycoon
- Posts: 1283
- Joined: 23 Oct 2009 19:35
- Location: Here and there, sometime or another
Re: NML - a Newgrf Meta Language
I guess I didn't fix it on my testing copy then ![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---
--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---
--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
Re: NML - a Newgrf Meta Language
Shouldn't NML be doing type checking to catch mistakes like these?Yexo wrote:Instead of the correct codeCode: Select all
misc_flags: ROADVEH_FLAG_2CC;
Code: Select all
misc_flags: bitmask(ROADVEH_FLAG_2CC);
Re: NML - a Newgrf Meta Language
Please keep in mind all of the following are also valid nml code:
Should NML still be able to detect the error in this case?
Also valid, but did the user really wanted the value 1 (make it a tram) or did he want to set bit 1 so it would be , in which case it's not a tram but 2cc is enabled?
Code: Select all
param[1] = bitmask(ROADVEH_FLAG_2CC);
param[2] = 1;
misc_flags: param[param[2]];
Code: Select all
misc_flags: 1;
Code: Select all
misc_flags: bitmask(1);
Re: NML - a Newgrf Meta Language
types are a tricky thing indeed. i imagine they had the same discussion 50 years ago when designing the first high level languages
the real question here is whether
should throw an error, and i think it should. there should be an explicit cast to interpret a value as a bitmask.
lack of strict type checking will only bite you in the face and punch you in the arse in the long run.
the real question here is whether
Code: Select all
misc_flags: 1;
lack of strict type checking will only bite you in the face and punch you in the arse in the long run.
Re: NML - a Newgrf Meta Language
Alternatively, you could introduce the concept 'bit-number' as numerical type. It may not work for every situation (I'd not forbid bitmask(1) ), but it may catch the large number of cases where the grf author uses pre-defined constants.
Re: NML - a Newgrf Meta Language
Here I disagree with you as allowing a literal number makes the conversion from nfo to nml a lot easier.Eddi wrote:the real question here is whethershould throw an error, and i think it should. there should be an explicit cast to interpret a value as a bitmask.Code: Select all
misc_flags: 1;
Re: NML - a Newgrf Meta Language
just to be clear: i mean something like
meaning a bitmask where bit 0 (value 1) is set, and
meaning a bitmask where bit 1 (value 2) is set.
names of the conversion macros may be seen as "just a suggestion"
Code: Select all
misc_flags: bitvalue(1);
Code: Select all
misc_flags: bitmask(1);
names of the conversion macros may be seen as "just a suggestion"
Re: NML - a Newgrf Meta Language
Is it possible to decompile a grf which has not been 'written'/made with NML?
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: NML - a Newgrf Meta Language
currently NewGRFs cannot (yet) be de-compiled into NML. The only available newgrf de-compiler is currently grfcodec which de-compiles into NFO only.Hyronymus wrote:Is it possible to decompile a grf which has not been 'written'/made with NML?
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: NML - a Newgrf Meta Language
And thus there is no converter for NFO > NML either?!
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: NML - a Newgrf Meta Language
Unfortunately the answer currently is 'no'. Only the reverse works.Hyronymus wrote:And thus there is no converter for NFO > NML either?!
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: NML - a Newgrf Meta Language
Hyronymus wrote:And thus there is no converter for NFO > NML either?!
If you want to learn NFO i can teach you, just add me to msn :=)
Re: NML - a Newgrf Meta Language
I managed basic NFO once but I got and get lost with advanced NFO. If I could i.e. add cargo support to the Dutch Trainset that would be nice but I just don't get it. Also, the Dutch Trainset was written with GRFmaker so I'm not confident on how clean and standard the code is.DJ Nekkid wrote:Hyronymus wrote:And thus there is no converter for NFO > NML either?!
If you want to learn NFO i can teach you, just add me to msn :=)
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: NML - a Newgrf Meta Language
grfmaker basically is incompatible with both nfo and nml sources, it's a completely separate format yet again.Hyronymus wrote: I managed basic NFO once but I got and get lost with advanced NFO. If I could i.e. add cargo support to the Dutch Trainset that would be nice but I just don't get it. Also, the Dutch Trainset was written with GRFmaker so I'm not confident on how clean and standard the code is.
If you want to kind-of start over with the Dutch trains, it's for a beginner probably easiest to start with NML - especially as you obviously got NML working. For getting started with trains you can look at OpenGFX+Trains' code. AFAIK everything wrt trains is supported in NML and the only thing I haven't (yet) coded into that set is an articulated vehicle, but that's feasable in NML, too (there's an articulated tram as regression test: http://dev.openttdcoop.org/projects/nml ... d_tram.nml).
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: NML - a Newgrf Meta Language
Hit me with a hammer hard enough and I mightplanetmaker wrote:grfmaker basically is incompatible with both nfo and nml sources, it's a completely separate format yet again.Hyronymus wrote: I managed basic NFO once but I got and get lost with advanced NFO. If I could i.e. add cargo support to the Dutch Trainset that would be nice but I just don't get it. Also, the Dutch Trainset was written with GRFmaker so I'm not confident on how clean and standard the code is.
If you want to kind-of start over with the Dutch trains, it's for a beginner probably easiest to start with NML - especially as you obviously got NML working. For getting started with trains you can look at OpenGFX+Trains' code. AFAIK everything wrt trains is supported in NML and the only thing I haven't (yet) coded into that set is an articulated vehicle, but that's feasable in NML, too (there's an articulated tram as regression test: http://dev.openttdcoop.org/projects/nml ... d_tram.nml).
![Razz :P](./images/smilies/icon_razz.gif)
Re: NML - a Newgrf Meta Language
True, and false. You can use GRFMaker to produce NFO, but I don't know what would be the point. GRFMaker can also import NFO, but the import is not complete, and not completely correct.planetmaker wrote:Hyronymus wrote:grfmaker basically is incompatible with both nfo and nml sources, it's a completely separate format yet again.
Re: NML - a Newgrf Meta Language
*snort*AndersI wrote:True, and false. You can use GRFMaker to produce NFO, but I don't know what would be the point. GRFMaker can also import NFO, but the import is not complete, and not completely correct.planetmaker wrote:Hyronymus wrote:grfmaker basically is incompatible with both nfo and nml sources, it's a completely separate format yet again.
Nice to know after, what, how many years now that folks are still spreading misinformation about GRFMaker.
You tell 'em AndersI
![Smile :)](./images/smilies/icon_smile.gif)
Currently working under the name 'reldred' on Github, and Discord.
NFO/NML coder, part-time patch writer for JGRPP, and all round belligerent.
14:40 <orudge> I can't say I discriminate against any particular user
14:41 <Aegir> orudge: I can!
NFO/NML coder, part-time patch writer for JGRPP, and all round belligerent.
14:40 <orudge> I can't say I discriminate against any particular user
14:41 <Aegir> orudge: I can!
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: NML - a Newgrf Meta Language
planetmaker wrote:grfmaker basically is incompatible with both nfo and nml sources, it's a completely separate format yet again.
Please stand by your snort and claim and show me the full grfmaker version of FIRS / SwedishRails / AirportsPlus / 2cctrainset.Aegir wrote:Nice to know after, what, how many years now that folks are still spreading misinformation about GRFMaker.
Yes, the import of a grf (or nfo, not much difference) is unfortunately the really difficult thing as it requires semantical understanding of the grf and full knowledge of the target language (which are the full newgrf specs). That's something which for an export is not needed, any programme knows its own data formats after all. And one can limit output to a subset of the full newgrf specs and write 100% correct NewGRF.AndersI wrote:You can use GRFMaker to produce NFO, but I don't know what would be the point. GRFMaker can also import NFO, but the import is not complete, and not completely correct.
Writing GRFs is a basic functionality for a NewGRF programming language, writing nfo then comes at relatively little extra costs. Given GRFMaker's "source" is a binary *.lst file (which is what I primarily had in mind when I said 'separate format'). Thus I think it's fair to say it has its own format - which is nothing bad, it just is so.
But possibly we should move any discussion needed about GRFMaker's to its own thread then.
EDIT: rephrased some misunderstandable wording.
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: NML - a Newgrf Meta Language
<snip>planetmaker wrote:planetmaker wrote:grfmaker basically is incompatible with both nfo and nml sources, it's a completely separate format yet again.Please stand by your snort and claim and show me the full grfmaker version of FIRS / SwedishRails / AirportsPlus / 2cctrainset.Aegir wrote:Nice to know after, what, how many years now that folks are still spreading misinformation about GRFMaker.
I had something more vulgar to say, I'm not in the business of proving or justifying myself to the likes of anyone on this forum. You don't 'get' it, that's obvious. That's fine. Folks were spreading BS about GRFMaker five years ago too.
![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
Currently working under the name 'reldred' on Github, and Discord.
NFO/NML coder, part-time patch writer for JGRPP, and all round belligerent.
14:40 <orudge> I can't say I discriminate against any particular user
14:41 <Aegir> orudge: I can!
NFO/NML coder, part-time patch writer for JGRPP, and all round belligerent.
14:40 <orudge> I can't say I discriminate against any particular user
14:41 <Aegir> orudge: I can!
Re: NML - a Newgrf Meta Language
And that does help exactly how? If GRFMaker really can do more than what planetmaker descriped please enlighten us. If you don't want to, fine, but keep out of here.
Who is online
Users browsing this forum: No registered users and 5 guests