Various NML related questions

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

Moderator: Graphics Moderators

User avatar
Andrew350
Chief Executive
Chief Executive
Posts: 682
Joined: 19 Dec 2011 07:54
Location: Washington State, USA
Contact:

Re: Various NML related questions

Post by Andrew350 »

McZapkie wrote: 12 Dec 2020 10:06 Is it possible to define default track type in menu (not the first one)?
Let say I have 3 tracktype, Slow, Medium, Fast, they appear in menu in such order,
any means to force Medium to be first choice when track menu is opened?
No. Which rail type gets selected first depends on the user's settings, and NewGRF can't influence that.
User avatar
paritcl3s
Engineer
Engineer
Posts: 9
Joined: 15 Jun 2020 08:01

Re: Various NML related questions

Post by paritcl3s »

Am currently trying to make a town name .grf.
I'm fresh to the task and have never made an attempt at a graphics pack.
So far I've tried deriving an .nfo from the elder scrolls name .grf.
nmlc --nfo=<file>

It returned a copy

Code: Select all

// 2 * 98	 08 07 "JS" 0F 01 "The Elder Scrolls Town Names" 00
	 8A "Coded Together by Jan Skoch" 0D 93 "GNU "
	 "GPL v2" 0D 91 "Version # 2013.04.26" 00
    3 * 1630	 0F 00 01 90 00 08 01 "Alftand" 00 01 "Arkngthamz" 00 01 "Avanchnzel" 00
	 01 "Blackreach" 00 01 "Bthalft" 00 01 "Bthardamz" 00
	 01 "Fahlbtharz" 00 01 "Irkngthand" 00 01 "Kagrenzel" 00
	 01 "Kagrumez" 00 01 "Mzinchaleft" 00 01 "Mzulft" 00 01
	 "Nchardak" 00 01 "Nchuand-Zel" 00 01 "Raldbthar" 00
It goes on like that basically.

The --nml output states lang/english.lng doesn't exit so not sure where to turn. Is there any template to follow for folder hierarchy for proper compilation?
User avatar
2TallTyler
Transport Coordinator
Transport Coordinator
Posts: 291
Joined: 11 Aug 2019 18:15
Location: Massachusetts, USA
Contact:

Re: Various NML related questions

Post by 2TallTyler »

Here’s a link to my town names repository. Each state is a separate NewGRF and NML project and there’s a makefile to compile them all using nmlc. Using NML is much easier than NFO.

https://github.com/2TallTyler/town_names
User avatar
Greyfur
Engineer
Engineer
Posts: 73
Joined: 31 Oct 2004 12:43
Location: Slovakia - Bratislava
Contact:

Re: Various NML related questions

Post by Greyfur »

IHi guys,

is this because I am using old nmlc?

Code: Select all

H:\CSBusSet\!!!!!!!!!!!!!!!!!!!!>nmlc CSBusSetN4.5.5.nml
[Knmlc ERROR: nmlc: An internal error has occurred:
nmlc-version: v6379:afad0c76c40b from 2017-06-19
Error:    (IndexError) "pop from empty list".
Command:  ['nmlc', 'CSBusSetN4.5.5.nml']
Location: File "nml\actions\action4.py", line 170, in get_string_action4s 
My project: CS Bus Set viewtopic.php?f=26&t=87962

Škoda - Praga - Tatra - Karosa - Oasa - Prima TL - Zliner - TAM BUS - SOR - Novoplan - Granus - Slovbus - Tedom - Irisbus - Iveco

Woof !
Eddi
Tycoon
Tycoon
Posts: 7622
Joined: 17 Jan 2007 00:14

Re: Various NML related questions

Post by Eddi »

in any case, NML shouldn't be crashing with an "internal error" like that, but return a proper error message about what is actually wrong with your code, so you should probably update, and report it with the code that triggers it if the problem persists

the typical cause for this kind of error is that some kind of ID-pool ran out, which may be fixable by rearranging some code
You might not exactly be interested in Ferion, but if you are, have fun :)
User avatar
Greyfur
Engineer
Engineer
Posts: 73
Joined: 31 Oct 2004 12:43
Location: Slovakia - Bratislava
Contact:

Re: Various NML related questions

Post by Greyfur »

I am getting the same with the newest stable windows one I could find.

Code: Select all

C:\NML>nmlc CSBusSetN4.5.5.nml
 nmlc ERROR: nmlc: An internal error has occurred:
nmlc-version: 0.5.0
Error:    (IndexError) "pop from empty list".
Command:  ['nmlc', 'CSBusSetN4.5.5.nml']
Location: File "nml\actions\action4.py", line 170, in get_string_action4s
the only difference is the text is now in red.

Are there any limits on how many vehicles, lines of code, switches, text lines in language file, etc there could be?
My project: CS Bus Set viewtopic.php?f=26&t=87962

Škoda - Praga - Tatra - Karosa - Oasa - Prima TL - Zliner - TAM BUS - SOR - Novoplan - Granus - Slovbus - Tedom - Irisbus - Iveco

Woof !
Eddi
Tycoon
Tycoon
Posts: 7622
Joined: 17 Jan 2007 00:14

Re: Various NML related questions

Post by Eddi »

there are many such limits, and nmlc usually outputs a statistics of how close you are to any of these limits. (if it doesn't crash, that is)

if it crashes with action4, you're probably running out of StringIDs (any string that's not a vehicle name, and there's like 1024 IDs available)
You might not exactly be interested in Ferion, but if you are, have fun :)
User avatar
Greyfur
Engineer
Engineer
Posts: 73
Joined: 31 Oct 2004 12:43
Location: Slovakia - Bratislava
Contact:

Re: Various NML related questions

Post by Greyfur »

Eddi wrote: 06 Jan 2021 08:25 there are many such limits, and nmlc usually outputs a statistics of how close you are to any of these limits. (if it doesn't crash, that is)

if it crashes with action4, you're probably running out of StringIDs (any string that's not a vehicle name, and there's like 1024 IDs available)
Thank you! :bow:

I didn't know there was such a limit. I will most likely have to split my grf in two or three parts I guess. I plan to do a reduction of duplicates, but with how much I will still have to add, it would definitely not fit into a 1024 limit.
My project: CS Bus Set viewtopic.php?f=26&t=87962

Škoda - Praga - Tatra - Karosa - Oasa - Prima TL - Zliner - TAM BUS - SOR - Novoplan - Granus - Slovbus - Tedom - Irisbus - Iveco

Woof !
User avatar
supermop
Tycoon
Tycoon
Posts: 1083
Joined: 21 Feb 2010 00:15
Location: Fitzroy North - 96

Re: Various NML related questions

Post by supermop »

I'm having trouble figuring out how to set the size and position of bounding boxes in NML, particularly for catenary sprites. While the spritelayout page of the specs mentions x, y and z extents and offsets, road and railtypes do not use sprite layouts, and the other spec pages make no mention of how to set the size or position of the bounding box, and only mention the 2d height and width of pixels in the png.

In the below image, trolleywire from my GRF has a bounding box the size of the entire tile, while rails from Termite have a bounding box the size of the wire itself - just a few px wide and tall.
BOUNDING BOXES.PNG
BOUNDING BOXES.PNG (48.9 KiB) Viewed 434 times
The template I use for my wires is as such:

Code: Select all

template tmpl_wire_normal() {           //regular catenary sprites 
    [ 10, 10, 64, 31, -31, 0]            // '\''
    [ 80, 10, 64, 31, -31, 0]            // '/'
    
For Unspooled this works ok, but for another GRF I am working on now, I really need to set the box to a smaller size, approx 6px wide and 5px tall. I have no idea how to do this...
isaacrdc
Engineer
Engineer
Posts: 36
Joined: 22 Jul 2019 14:07

Re: Various NML related questions

Post by isaacrdc »

Afaik you can't make it smaller except in buildings, objects and vehicles. Bounding boxes are only used as a guide to avoid graphical glitches and for deciding the position of the sprite(s). It is independent of template and cannot be moved.

Railway and Tramway bounding boxes acts different, tramways have two wires a front and back while railways only have one.

I think there is no issue regarding how small you're drawing the wire, unless you're making very large sprite that overlaps bounding boxes that make graphical glitches.
Fromerly known as Alon
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 4 guests