NML - a Newgrf Meta Language
Moderator: Graphics Moderators
Re: NML - a Newgrf Meta Language
How can I set property 00 before property 2A in NML for trains?
I need the introduction date of the train without randomize it. Can I do this?
I need the introduction date of the train without randomize it. Can I do this?
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: NML - a Newgrf Meta Language
By design, you can't, neither in nfo nor nml. Randomization always happens, except in the first two years after the game was started.akasoft wrote:How can I set property 00 before property 2A in NML for trains?
I need the introduction date of the train without randomize it. Can I do this?
Using long or short introduction date has no influence there neither. Property 2A (long introduction date) deprecated property 00 (short introduction date). Using the long introduction date in the range between 1920 to 2044 behaves identical to just using the short introduction date. NML thus always uses the long vehicle introduction date.
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
The only reason to use the short introduction date would be to support TTDPatch before 2.5 r1210. Since support for TTDPatch is almost completely untested and non-existent in a few other places I'm not going to add support for it unless someone is going to test support for TTDPatch extensively and report what exactly works and what doesn't.
Re: NML - a Newgrf Meta Language
What about support NewGRF v8 (r23159) in NML?
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: NML - a Newgrf Meta Language
Certainly. But after 0.2 has been released.akasoft wrote:What about support NewGRF v8 (r23159) in 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
If I forget to use utf-8 with Cyrillic and use windows-1251 instead of it, I receive error:
(Used wrong encoding, need utf-8 instead of it.)nmlc: An internal error has occurred:
nmlc-version: r68M (4453c155361b)
Error: (UnicodeDecodeError) "'utf8' codec can't decode byte 0xee in position 3928: invalid continuation byte".
Command: ['nmlc', '--nfo=xussr.nfo', '--grf=xussr.grf', '--nml=xussr_optimized.nml', '-M', '--MF=xussr_dep.txt', 'xussr.nml']
Location: File "C:\Python27\lib\codecs.py", line 477, in read
Re: NML - a Newgrf Meta Language
Can NML support string control code "01 X offset in next byte of string (variable space)"? This is useful for the name of vehicle.
Re: NML - a Newgrf Meta Language
In source of opengfx+ trains I found this code:
What is mean? We can change shorten_vehicle in livery_override block separately for selected vehicle ID? Specified value is for passenger_wagon or for turbotrain? And we can change shorten_vehicle in graphics block? Or this bug and so do not?
Code: Select all
...
item(FEAT_TRAINS, turbotrain, 20) {
...
graphics {
shorten_vehicle: return SHORTEN_TO_7_8;
turbotrain_engine_reversal_switch;
}
livery_override (passenger_wagon) {
shorten_vehicle: return SHORTEN_TO_7_8;
turbotrain_passenger_reversal_switch;
}
livery_override (mail_wagon) {
shorten_vehicle: return SHORTEN_TO_7_8;
turbotrain_mail_reversal_switch;
}
...
Re: NML - a Newgrf Meta Language
It's not a property, it's a callback. And yes, if you have a livery_override block you should copy all callbacks for the attaching vehicle to there. The first "shorten_vehicle" (in the graphics block) is for the turbotrain, the second oen for the passenger wagon when it's attached to the turbotrain, and the 3rd one for the mail wagon when it's attached to the turbotrain.
Is this really necesary? Doesn't OpenTTD automatically align the names of vehicles next to the sprites?akasoft wrote:Can NML support string control code "01 X offset in next byte of string (variable space)"? This is useful for the name of vehicle.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: NML - a Newgrf Meta Language
It's the preferred way to use callbacks. See http://newgrf-specs.tt-wiki.net/wiki/NM ... hics_block and http://newgrf-specs.tt-wiki.net/wiki/NM ... _callbacksakasoft wrote:In source of opengfx+ trains I found this code:
What is mean? We can change shorten_vehicle in livery_override block separately for selected vehicle ID? Specified value is for passenger_wagon or for turbotrain? And we can change shorten_vehicle in graphics block? Or this bug and so do not?Code: Select all
... item(FEAT_TRAINS, turbotrain, 20) { ... graphics { shorten_vehicle: return SHORTEN_TO_7_8; turbotrain_engine_reversal_switch; } livery_override (passenger_wagon) { shorten_vehicle: return SHORTEN_TO_7_8; turbotrain_passenger_reversal_switch; } livery_override (mail_wagon) { shorten_vehicle: return SHORTEN_TO_7_8; turbotrain_mail_reversal_switch; } ...
Of course callbacks are vehicle-specific, in this case they only apply when the quoted livery-override is active for the wagons.
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
last time i looked, nothing of that sort was implemented, buy menu had a fixed offset.Yexo wrote:Is this really necesary? Doesn't OpenTTD automatically align the names of vehicles next to the sprites?akasoft wrote:Can NML support string control code "01 X offset in next byte of string (variable space)"? This is useful for the name of vehicle.
IMHO the GRF should set a "generic" property about the width of the buy menu sprites it would like (per vehicle type?), and the game should take the maximum over all GRFs.
"X offset" is generally a bad thing, especially with automatically scaling GUIs, and i think OpenTTD actually ignores that. we had a very lengthy debate about this previously.
Re: NML - a Newgrf Meta Language
This string control code is used in 2cc trainset and look nice.Eddi wrote: last time i looked, nothing of that sort was implemented, buy menu had a fixed offset.
Re: NML - a Newgrf Meta Language
the problem here is that the string is used in other places as well, which might not want to use such an offset.akasoft wrote:This string control code is used in 2cc trainset and look nice.Eddi wrote: last time i looked, nothing of that sort was implemented, buy menu had a fixed offset.
Re: NML - a Newgrf Meta Language
Can I in NML get the current train property 21 (shorten_vehicle) via variable?
(And then use it in selection of spriteset.)
(And then use it in selection of spriteset.)
Re: NML - a Newgrf Meta Language
according to TTD-locations this is variable 0x80+0x73 (=0xF3), so if nml does not yet have a variable name for this, you should be able to access this by "var[0xF3, 0, 0xFF]"
Re: NML - a Newgrf Meta Language
Eddi, thanks. I was confused by prefix "[TTDPatch]".
Re: NML - a Newgrf Meta Language
if in doubt, doublecheck with src/newgrf_engine.cpp:
Code: Select all
case 0x73: return t->gcache.cached_veh_length;
Re: NML - a Newgrf Meta Language
Hmm, either this line is an OpenTTD bug or it is a documentation bug. I would read "how much shorter the wagon is" as the value passed to prop 21 (i.e. that many lu shorten than normal), while OpenTTD stores the length and not the shorten factor in cached_veh_length.Eddi wrote:if in doubt, doublecheck with src/newgrf_engine.cpp:Code: Select all
case 0x73: return t->gcache.cached_veh_length;
Re: NML - a Newgrf Meta Language
TTDPatch source code says Usage in loadunl.asm seems to match this documentation. It looks to me like the high bit is used for TTDPatch internal record-keeping and is always set in contexts where GRFs could see the information.
Code: Select all
.shortened: // 73h:how much shorter is the wagon (+0x80)
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Who is online
Users browsing this forum: No registered users and 27 guests