NML 0.5.3 released 15th September 2020

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

Moderator: Graphics Moderators

User avatar
andythenorth
Tycoon
Tycoon
Posts: 5216
Joined: 31 Mar 2007 14:23
Location: Lost in Music

NML 0.5.3 released 15th September 2020

Post by andythenorth »

Update: 0.5.3 released 15th September 2020 > viewtopic.php?p=1235979#p1235979

----------
Now available on PyPI for 'pip install nml' in Python: NML 0.5.0 https://pypi.org/project/nml/

A Windows binary is also available: https://github.com/OpenTTD/nml/releases/tag/0.5.0

NML 0.5.0 is a substantial release, covering multiple areas of the newgrf spec. Thanks to everyone who helped.

Industries
----------
NOTE TO AUTHORS: NML 0.5.0 removes many industry properties and vars.
Industry sets using these properties or vars will *not* compile with nml 0.5.0 and need to be updated.
All industry vars removed in 0.5.0 are replaced by equivalent new vars.
Production callback (produce block) format also changed so produce blocks will need to be updated.
We don't break NML backwards compatibility lightly, but this change was necessary to support 16 accepted and 16 produced cargos.
Thanks.
  • Support for up to 16 accepted cargos and 16 produced cargos (available in OpenTTD 1.9.0 onwards)
  • New industry properties and vars
    • cargo_types
    • incoming_cargo_waiting
    • produced_cargo_waiting
    • this_month_production
    • last_month_production
    • this_month_transported
    • last_month_transported
    • transported_last_month_pct
    • production_rate
  • Removed legacy industry properties and vars
    • accept_cargo_types
    • prod_cargo_types
    • prod_multiplier
    • input_multiplier_1
    • input_multiplier_2
    • input_multiplier_3
    • production_rate_1
    • production_rate_2
    • waiting_cargo_1
    • waiting_cargo_2
    • waiting_cargo_3
    • produced_cargo_waiting_1
    • produced_cargo_waiting_2
    • produced_this_month_1
    • produced_this_month_2
    • produced_last_month_1
    • produced_last_month_2
    • transported_this_month_1
    • transported_this_month_2
    • transported_last_month_1
    • transported_last_month_2
    • transported_last_month_pct_1
    • transported_last_month_pct_2
  • New approach to tile cargo acceptance
    • use INDTILE_FLAG_ACCEPT_ALL to accept all cargos industry accepts
    • or use up to 16 cargos with accepted_cargos property
  • Production callback format changed - see https://newgrf-specs.tt-wiki.net/wiki/NML:Produce
Industry docs: https://newgrf-specs.tt-wiki.net/wiki/NML:Industries
industry tile docs: https://newgrf-specs.tt-wiki.net/wiki/NML:IndustryTiles

Houses
------
  • Support for up to 16 accepted cargos at houses
Houses docs: https://newgrf-specs.tt-wiki.net/wiki/NML:Houses


Roadtypes and Tramtypes
-----------------------
  • Support for Roadtypes and Tramtypes (available in OpenTTD 1.10.0 onwards)
Roadtypes docs; https://newgrf-specs.tt-wiki.net/wiki/NML:Roadtypes
Tramtypes docs: https://newgrf-specs.tt-wiki.net/wiki/NML:Tramtypes


Railtypes
---------
  • Increase railtype ID range from 16 to 64, to support 64 railtypes
  • Railtype flag RAILTYPE_FLAG_HIDDEN for hiding a railtype from player construction menu
  • Railtype flags RAILTYPE_FLAG_ALLOW_90DEG and RAILTYPE_FLAG_DISALLOW_90DEG for 90 degree curves
  • Railtype flags RAILTYPE_FLAG_HIDDEN and RAILTYPE_FLAG_PRECOMBINED for precombined spriteset type
Railtypes docs: https://newgrf-specs.tt-wiki.net/wiki/NML:Railtypes


Procedures
----------
  • Support for use of switches and random switches as procedures, reducing repetition of switches
There are no docs for this at the time of release.


Other Changes
-------------
  • Feature: Add ANIM_TRIGGER_APT_AIRPLANE_LANDS (follows OpenTTD #7182)
  • Feature: Add station var nearby_tile_grfid (0x6A)
  • Feature: Add TTDPatchFlag 256_persistent_registers (0x80)
  • Feature: PUSH/POP_COLOUR codes for strings
  • Feature: Debug_print for GRF parameters
  • Feature: Allow PLY to generate parsing/lexing tables (improves performance); regeneration can be forced with nmlc -R
  • Feature: syntax highlighting support for Visual Studio Editor
  • Change: improved colouring of nmlc errors and warnings (where shell/terminal supports this)
  • Change: Make sprite encoder warnings more informative (#89)
  • Add: nmlc -D option to enable debug mode for parser
  • Fix #36: Global variable traffic_side was inconsistent with global parameter traffic_side
  • Fix #39: Add compatibility with >=pillow-7.0.0
  • Fix #52: Compatibility with python 3.8
  • Fix #57: GRF parameters could be given negative values
  • Fix: Add missing parameter in industry and airport tiles in RandomAction2
  • Fix: Properly clean up resource handles (eliminates 'too many open files' error on macOS with larger GRFs)
  • Codechange: Update nml version detection to support Git using similar approach to OpenTTD
  • Doc: Update example train nml to demonstrate use of sprite stack and vehicle length
  • Doc/Fix: Update the stated version requirements
Last edited by andythenorth on 15 Sep 2020 11:09, edited 5 times in total.

User avatar
jfs
Tycoon
Tycoon
Posts: 1240
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: NML 0.5.0 released 26th April 2020

Post by jfs »

A little detail is also that NewGRFs with industries generated by NML 0.5.0 are only compatible with OpenTTD 1.9.0 and later, NML 0.5.0 is not capable of making industry NewGRFs that work with older versions of OpenTTD. If you need your industry set to remain compatible with old versions then you need to stay on the previous NML version too.

ufiby
Engineer
Engineer
Posts: 56
Joined: 18 Nov 2017 13:58

Re: NML 0.5.0 released 26th April 2020

Post by ufiby »

Hurray! But one more thing, road and tram types are limited to 15.

User avatar
andythenorth
Tycoon
Tycoon
Posts: 5216
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: NML 0.5.0 released 26th April 2020

Post by andythenorth »

ufiby wrote:
26 Apr 2020 14:43
Hurray! But one more thing, road and tram types are limited to 15.
Is that a bug report for nml, or for the nml docs, or a bug for OpenTTD?

Thanks.

ufiby
Engineer
Engineer
Posts: 56
Joined: 18 Nov 2017 13:58

Re: NML 0.5.0 released 26th April 2020

Post by ufiby »

This is an NML error report

Code: Select all

c:\NML>nmlc --version
0.5.0
Library versions encountered:
PIL: 7.1.2
PLY: 3.11

c:\NML>nmlc --grf=URaTT.grf URaTT.nml
 nmlc ERROR: "URaTT.nml", line 2528: Unable to allocate ID for item, no more free IDs available (maximum is 15)


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

Re: NML 0.5.0 released 26th April 2020

Post by GarryG »

Just curiosity at the moment as I get this warning in NML 0.5.0 when I run nmlc to code my object sets. Never got this message with previous version.

Code: Select all

←[K←[93m nmlc warning: "AuzWaterObjects.nml", line 322: "gfx/transitionshore04.p
ng" at [x: 239, y: 2]: 525 of 2816 pixels (18%) are animated, but ANIM isn't in
flags←[0m
Getting that message with basically all the objects in the set .. yet I have these command included in my codes

Code: Select all

       object_flags: bitmask(OBJ_FLAG_ANIMATED, OBJ_FLAG_RANDOM_ANIMATION);
Do I have to inclde some thing new in codes now?

EDIT: Forgot to mention it only those that have water in the object.
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: 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
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335

User avatar
andythenorth
Tycoon
Tycoon
Posts: 5216
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: NML 0.5.0 released 26th April 2020

Post by andythenorth »

Might just be missing the ANIM flag on the realsprites

https://newgrf-specs.tt-wiki.net/wiki/NML:Realsprites

Or might be a bug in nmlc. :)

Try the realsprites ANIM flag first.

If that doesn't work, post nml for one of the objects here. Then I will take a look.

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

Re: NML 0.5.0 released 26th April 2020

Post by GarryG »

andythenorth wrote:
05 May 2020 07:16
Might just be missing the ANIM flag on the realsprites
In the templates my original settings were:

Code: Select all

template template_building_low(x,y,filename) {
    [x+14, y+2, 64, 44, -31, -13, filename]
    [x+89, y+2, 64, 44, -31, -13, filename]
    [x+164, y+2, 64, 44, -31, -13, filename]
    [x+239, y+2, 64, 44, -31, -13, filename]
}
but when I changed it to:

Code: Select all

template template_building_low(x,y,filename) {
    [x+14, y+2, 64, 44, -31, -13, ANIM, filename]
    [x+89, y+2, 64, 44, -31, -13, ANIM, filename]
    [x+164, y+2, 64, 44, -31, -13, ANIM, filename]
    [x+239, y+2, 64, 44, -31, -13, ANIM, filename]
}
I don't get that message for objects that used that template now.

Just strange previous versions of NML never asked that.

Cheers pal
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: 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
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335

User avatar
andythenorth
Tycoon
Tycoon
Posts: 5216
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: NML 0.5.0 released 26th April 2020

Post by andythenorth »

NML 0.5.1 released 11th May 2020

Now available on PyPI for 'pip install nml' in Python: NML 0.5.1 https://pypi.org/project/nml/

A Windows binary is also available: https://github.com/OpenTTD/nml/releases/tag/0.5.1

Bug reports, issues and contributions go to GitHub, cheers :) https://github.com/openTTD/nml

This release fixes a number of issues reported in 0.5.0.

Note:
Although nmlc now permits up to 63 each of road and tramtypes, OpenTTD currently requires that the combined total not be more than 63 and that the same label not be used for both a roadtype and a tramtype.
These limitations are not checked by nmlc. Authors need to manage these limitations directly within the grf design.
  • Add: Builtin functions roadtype() and tramtype()
  • Fix: Allow calculations for palette in spritelayout
  • Fix #116: TownNames used bits could be the same for sub-parts (#117)
  • Fix #120: Value range of transported_last_month_pct should be 0..100 (#122)
  • Fix #121: STORE_PERM address limit should be 255, not 15
  • Fix #134: Incorrect value of PALETTE_CC_RED
  • Fix #74: Update ottd_display_speed to match changes from OpenTTD r23945 (#75)
  • Fix: ANIM warnings in examples
  • Fix: Make the industry example GRF do something, rather than crashing
  • Fix: Correct limit of available road/tramtypes
  • Fix: Produce, TownNames & TracktypeTable debug_print (#126, #127, #129)
  • Fix: Don't attempt to determine version from git when building from a release tarball

User avatar
FLHerne
Tycoon
Tycoon
Posts: 1543
Joined: 12 Jul 2011 12:09
Location: St Ives, Cambs, UK

Re: NML 0.5.0 released 26th April 2020

Post by FLHerne »

NML 0.5.2 released 17th May 2020.
Please report any issues on GitHub.

This release primarily fixes a spritelayout-related bug introduced in 0.5.1 that may affect many grfs.

Changes:
  • Fix #140: non-advanced sprite layouts don't have flags
  • Fix: Make --cache-dir work
  • Fix #139: Don't create the cache directory if --no-cache is passed
Temporary Permanent signature filling text. Content coming soon delayed indefinitely! Oh, and I have had a screenshot thread.
Linux user (XMonad DWM/KDE, Arch), IRC obsessive and rail enthusiast. No longer building robots; now I ring church bells.
Author of an incredibly boring stickied post about NewGRFs.

Vanderbildt
Engineer
Engineer
Posts: 27
Joined: 24 Feb 2016 16:40

Re: NML 0.5.0 released 26th April 2020

Post by Vanderbildt »

Hello
is there any possibility that you please change:

(incoming_cargo_waiting("TOYS") To (incoming_cargo_waiting("1")

and so on

User avatar
andythenorth
Tycoon
Tycoon
Posts: 5216
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: NML 0.5.0 released 26th April 2020

Post by andythenorth »

Vanderbildt wrote:
04 Jul 2020 11:13
is there any possibility that you please change:
(incoming_cargo_waiting("TOYS") To (incoming_cargo_waiting("1")
"1" is not a valid cargo label. Cargo labels have 4 characters.

What are you trying to do?

Vanderbildt
Engineer
Engineer
Posts: 27
Joined: 24 Feb 2016 16:40

Re: NML 0.5.0 released 26th April 2020

Post by Vanderbildt »

i will transform this download/file.php?id=212739 from nml 0.4 to nml 0.5

User avatar
jfs
Tycoon
Tycoon
Posts: 1240
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: NML 0.5.0 released 26th April 2020

Post by jfs »

No, the new produce block that was defined to support 16 in/16 out industries does not support handling cargo types by index, and neither do the new stockpile etc. properties that support 16 in/16 out. It's not a question of having NML support it, the way it's implemented in OpenTTD itself makes it impossible to support.

You need to find a different way to do what you want.

Vanderbildt
Engineer
Engineer
Posts: 27
Joined: 24 Feb 2016 16:40

Re: NML 0.5.0 released 26th April 2020

Post by Vanderbildt »

This answer is realy not funny. and by the way 64 cargos are, iam sorry, a little bit poor.
Until now may iam blind but i cant see any benefit between the old and the new ottd.
ottd 1.9 didnt fall from sky but if a lot of things in 1.6 posible and now are lost then, what shall i say. We all like little britan or the computer says: no!
anyway iam shure a lot of people do a lot of work thank you.

User avatar
jfs
Tycoon
Tycoon
Posts: 1240
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: NML 0.5.0 released 26th April 2020

Post by jfs »

All the old features are still available, the old actions and properties used in NewGRF all exist and work as they used to. It's only if you want to make industries with more than 3 input cargo types or 2 output cargo types you need to use the new properties. Yes NML 0.5.0 removed the support for writing GRF files using the old ones, but a later version (I think 0.5.2?) has added it back, as far as I remember.

User avatar
andythenorth
Tycoon
Tycoon
Posts: 5216
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: NML 0.5.0 released 26th April 2020

Post by andythenorth »

The release that restores the 0.4 syntax is not done yet.

The pull request is done https://github.com/OpenTTD/nml/pull/152

But that needs nml 0.5.3 release.

The intent of that is to allow old code to keep compiling. It does not make the old syntax work for 16 input or 16 output cargos.

When 0.5.3 is release, it will be announced in this thread, or a new thread in this forum.

Vanderbildt
Engineer
Engineer
Posts: 27
Joined: 24 Feb 2016 16:40

Re: NML 0.5.0 released 26th April 2020

Post by Vanderbildt »

Thank You

User avatar
andythenorth
Tycoon
Tycoon
Posts: 5216
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: NML 0.5.0 released 26th April 2020

Post by andythenorth »

Sorry, I can't give any ETA on nml 0.5.3, it's awaiting, which I cannot influence any further https://github.com/OpenTTD/nml/pull/159

Sorry for letting you down, and this mess with nml. It really needs looked after by people who aren't me. All I do is f*** it up.

Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 4 guests