NML - a Newgrf Meta Language
Moderator: Graphics Moderators
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: NML - a Newgrf Meta Language
EDIT: removed code which only works for some corner cases. See Yexo's posting below for a proper solution.
Last edited by planetmaker on 27 Oct 2010 09:23, edited 1 time in total.
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
While that works, it's a hack and the proper code also works:
Code from ogfx-trains, modified to always use the toyland graphics in the menu.
Code: Select all
graphics {
0xFF: toyland_passenger_rail_group;
normal_passenger_switch;
}
Re: NML - a Newgrf Meta Language
I would have sworn I tried that and it did not work, but of course it does.
Thank you both.

Thank you both.
Re: NML - a Newgrf Meta Language
how to install it???



Re: NML - a Newgrf Meta Language
Lord Aro wrote:Morning all!
I have decided to see if i can give NewGRF-ing a go, but am struggling to install it properly
Is there a guide or even just a list of packages needed to install?
I'm on ubuntu 10.04 (10.10 coming soon!)
PS i have read the reference.htm
Yexo wrote:python
python-imaging
ply (from http://www.dabeaz.com/ply/ )
I hope I didn't forget anything.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: NML - a Newgrf Meta Language
The documentation has an as comprehensive guide as we could come up with http://hg.openttdcoop.org/nml/raw-file/ ... stallationxenon wrote:how to install it???![]()
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
I didn't see that last time i looked! 
When was it added? Or did i just miss it?

When was it added? Or did i just miss it?
AroAI - A really feeble attempt at an AI
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
Re: NML - a Newgrf Meta Language
i red the docs but still don't get it. i have python,pil, but how to install ply and mnl in windows x64?? i get error messages every time i trying to run setup.py via IDLE
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: NML - a Newgrf Meta Language
You install them by fixing the errors.
My answer is as precise as your question.
My answer is as precise as your question.
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
ok. i should rephrase my question. where should place the files?? how to properly execute setup?? with which program?? i don't have ANY expireince with python.
iget this when trying to run the setup via python
iget this when trying to run the setup via python
Code: Select all
Python 2.7 (r27:82525, Jul 4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
Traceback (most recent call last):
File "C:\Python27\Scripts\setup.py", line 34, in <module>
scripts=['nmlc'],
File "C:\Python27\lib\distutils\core.py", line 140, in setup
raise SystemExit, gen_usage(dist.script_name) + "\nerror: %s" % msg
SystemExit: usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: no commands supplied
>>>
Re: NML - a Newgrf Meta Language
Open a command window (start->run...-> cmd)
In the command window, go to the directory with setup, and run it with python:
You can do the same with nml, but it is not needed, as you need the terminal window also for running nmlc, and at that time, the directories are set up such that it also works without installing.
To run nml:Gives help, I think you need 'nmlc --grf myfile.grf myfile.nml' to convert 'myfile.nml' to .grf. You can also output .nfo files.
Edit: fixed some white spaces, and the \path\to\nml-x.y
In the command window, go to the directory with setup, and run it with python:
Code: Select all
> cd \path\to\ply-x.y
> python setup.py install
To run nml:
Code: Select all
> cd \path\to\nml-x.y
> python nmlc --help
Edit: fixed some white spaces, and the \path\to\nml-x.y
Re: NML - a Newgrf Meta Language
thanks. i think i get now. i'll write if i'll have any other questions.
how to create lang file?? how to create palette to my sprite?? do i need to do this??
how to create lang file?? how to create palette to my sprite?? do i need to do this??
Re: NML - a Newgrf Meta Language
There is Python Imaging Library 1.1.7 for Python 2.6 but not for 2.7. Is it safe to use python 2.7?planetmaker wrote:The documentation has an as comprehensive guide as we could come up with http://hg.openttdcoop.org/nml/raw-file/ ... stallationxenon wrote:how to install it???![]()
EDIT: Answer:No.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: NML - a Newgrf Meta Language
Binary instalator of PIL is crashing on windows 7. How can I get files installable by:planetmaker wrote:The documentation has an as comprehensive guide as we could come up with http://hg.openttdcoop.org/nml/raw-file/ ... stallationxenon wrote:how to install it???![]()
Code: Select all
python setup.py install
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: NML - a Newgrf Meta Language
rule of thumb: if the libary interfaces to C/C++/other language code, then not, unless you compile yourself. if it only consists of python code, then it is probably fine (but in rare cases needs updating for some language features)Kogut wrote:There is Python Imaging Library 1.1.7 for Python 2.6 but not for 2.7. Is it safe to use python 2.7?planetmaker wrote:The documentation has an as comprehensive guide as we could come up with http://hg.openttdcoop.org/nml/raw-file/ ... stallationxenon wrote:how to install it???![]()
EDIT: Answer:No.
Re: NML - a Newgrf Meta Language
I just checked, PIL does use compiled libraries of its own at my linux system. It is probably the same at Win* systems.
If you want to use 'python setup.py install' (that is, install PIL from source code), you must at least download the PIL source code and install the same compiler as used for building the python.exe . If PIL needs other libraries to be available, you must install those first.
The distutils module (part of the python library, comes with python.exe) used by setup.py will compile the libraries, and install the PIL pytlhon code.
I would be surprised if you are the first with a crashing PIL installer, perhaps you should ask at some PIL group/channel/forum about it?
If you want to use 'python setup.py install' (that is, install PIL from source code), you must at least download the PIL source code and install the same compiler as used for building the python.exe . If PIL needs other libraries to be available, you must install those first.
The distutils module (part of the python library, comes with python.exe) used by setup.py will compile the libraries, and install the PIL pytlhon code.
I would be surprised if you are the first with a crashing PIL installer, perhaps you should ask at some PIL group/channel/forum about it?
Re: NML - a Newgrf Meta Language
There is a binary for 2.7, this doesn't work?
http://effbot.org/downloads/#pil
http://effbot.org/downloads/#pil
Town Names:


Still work in progress: OpenGFX or/and OpenSFX - Please help!
-
- Tycoon
- Posts: 1283
- Joined: 23 Oct 2009 19:35
- Location: Here and there, sometime or another
Re: NML - a Newgrf Meta Language
I have two complaints (both with NML r1047):
1. This is probably more serious: a language file was not recognized. I put it in the "lang" folder, set it up according to the documentation, saved it in UTF-8 encoding, but I still got an error message about an undefined string. solved
2. Less important: NML can't handle numbers in railtype names. This makes it hard, if not impossible, to make third rail (3RDR) vehicles.
3. Another thing cropped up: I could not make a road vehicle be introduced in any climate.
Test code can be found in the attachment.
...Well, now it's decided not to work at all (in the very newest version). The error can be seen in the screenshot.
1. This is probably more serious: a language file was not recognized. I put it in the "lang" folder, set it up according to the documentation, saved it in UTF-8 encoding, but I still got an error message about an undefined string. solved
2. Less important: NML can't handle numbers in railtype names. This makes it hard, if not impossible, to make third rail (3RDR) vehicles.
3. Another thing cropped up: I could not make a road vehicle be introduced in any climate.
Test code can be found in the attachment.
...Well, now it's decided not to work at all (in the very newest version). The error can be seen in the screenshot.
- Attachments
-
- mc8.pnml.txt
- (1.38 KiB) Downloaded 253 times
-
- screenshot.png (39.56 KiB) Viewed 6429 times
--- 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. ---
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: NML - a Newgrf Meta Language
Confirmed. That's nasty.oberhümer wrote: 2. Less important: NML can't handle numbers in railtype names. This makes it hard, if not impossible, to make third rail (3RDR) vehicles.
Your example fails to use bitmasks in a few places:oberhümer wrote: 3. Another thing cropped up: I could not make a road vehicle be introduced in any climate.
Code: Select all
refittable_cargo_classes: bitmask(CC_PASSENGERS);
callback_flags: bitmask(VEH_CBF_REFITTED_CAPACITY);
Code: Select all
climates_available: bitmask(CLIMATE_TEMPERATE, CLIMATE_ARCTIC, CLIMATE_TROPIC);
Code: Select all
climates_available: ALL_CLIMATES // note that it's not climates_all and no bitmask there
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
-
- Tycoon
- Posts: 1283
- Joined: 23 Oct 2009 19:35
- Location: Here and there, sometime or another
Re: NML - a Newgrf Meta Language
Thanks for the help. I'll see if it works now.
(It does. Seems the problem was my Python installation.)
However, I have another small problem: the way language files begin seems to have changed from "lang: XX" to "##grflangid XX", and the documentation doesn't seem to have noticed. E.g.: I have no idea which numbers to use, the IDs seem to be completely different (at least 7F or 127 does not mean "default").
(It does. Seems the problem was my Python installation.)
However, I have another small problem: the way language files begin seems to have changed from "lang: XX" to "##grflangid XX", and the documentation doesn't seem to have noticed. E.g.: I have no idea which numbers to use, the IDs seem to be completely different (at least 7F or 127 does not mean "default").
--- 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. ---
Who is online
Users browsing this forum: No registered users and 14 guests