<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://newgrf-specs.tt-wiki.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Qazzian</id>
	<title>GRFSpecs - User contributions [en-gb]</title>
	<link rel="self" type="application/atom+xml" href="https://newgrf-specs.tt-wiki.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Qazzian"/>
	<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/wiki/Special:Contributions/Qazzian"/>
	<updated>2026-04-24T07:07:28Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Getting_started&amp;diff=3498</id>
		<title>NML:Getting started</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Getting_started&amp;diff=3498"/>
		<updated>2014-02-10T17:10:57Z</updated>

		<summary type="html">&lt;p&gt;Qazzian: Add instructions for installing with pip&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavNoSubpages}}&lt;br /&gt;
&lt;br /&gt;
== What is NML? ==&lt;br /&gt;
NML is a a python-based compiler, capable to compile NML files (along with their associated language, sound and graphic files) into grf and / or nfo files.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
=== pip ===&lt;br /&gt;
If you are familiar with python and pip then you can just use &lt;br /&gt;
    pip install nml&lt;br /&gt;
This will install the required dependancies. Note that you may need administrator privileges for this to work.&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
Windows users can install the [http://bundles.openttdcoop.org/nml/nightlies/LATEST/ windows binary] which contains a binary which bundles all required libraries.&lt;br /&gt;
&lt;br /&gt;
=== Linux ===&lt;br /&gt;
Users on other OS need to install them separately, best by means of their packet manager. In order to work, the following items are required:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;python&#039;&#039;&#039;&lt;br /&gt;
** any version from 2.5 through 2.7 will do, but not 3.x&lt;br /&gt;
** downloadable from from http://www.python.org/)&lt;br /&gt;
** Advise for windows users: apparently you can prevent a lot of problems by installing the 32bit version of python, even if you have a 64bit windows installation. Installing PIL might be troublesome if you do install the 64bit version of python.&lt;br /&gt;
* &#039;&#039;&#039;python image library&#039;&#039;&#039;&lt;br /&gt;
** downloadable from https://pypi.python.org/pypi/Pillow/&lt;br /&gt;
* &#039;&#039;&#039;ply&#039;&#039;&#039;&lt;br /&gt;
** downloadable from http://www.dabeaz.com/ply/&lt;br /&gt;
* &#039;&#039;&#039;NML itself&#039;&#039;&#039;&lt;br /&gt;
** the latest (nightly) build can be downloaded from http://bundles.openttdcoop.org/nml/nightlies/LATEST/&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t install these with the packet manager of your choice (or there is none like on windows and you don&#039;t use the pre-compiled binary file), you should install these libraries as well as NML itself using &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;python setup.py install&amp;lt;/code&amp;gt; from your command prompt.&lt;br /&gt;
&lt;br /&gt;
=== OSX ===&lt;br /&gt;
OS X users have two choices: install the dependencies manually as described in the Linux section above, for use with the python version that ships with OS X. Or install everything from macports, including a new python version (using macports eases upgrading).  However using macports to install the dependencies for the bundled system python is likely to fail.&lt;br /&gt;
&lt;br /&gt;
=== Installing manually (any system) ===&lt;br /&gt;
We assume that you have a python setup (2.5 ... 2.7) where the distutils are available so that setup.py can be executed. You&#039;ll additionally need a gcc compiler in your path. On linux it is strongly recommended to use your package manager to install these packages.&lt;br /&gt;
&lt;br /&gt;
==== Install PLY ====&lt;br /&gt;
This is easy. Get the library from the link as mentioned above.&lt;br /&gt;
Install it from the unpacked PLY directory via&lt;br /&gt;
 sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
==== Install the Python Imaging Library (PIL) ====&lt;br /&gt;
Get the library from the above mentioned link (the source kit for PIL 1.1.7). From the PIL source directory, test the setup for all available dependencies:&lt;br /&gt;
 python setup.py build_ext -i&lt;br /&gt;
You should get an output like which concludes with a summary of the available dependencies:&lt;br /&gt;
 PIL 1.1.7 SETUP SUMMARY&lt;br /&gt;
 --------------------------------------------------------------------&lt;br /&gt;
 --- TKINTER support available&lt;br /&gt;
 --- JPEG support available&lt;br /&gt;
 --- ZLIB (PNG/ZIP) support available&lt;br /&gt;
 --- FREETYPE2 support available&lt;br /&gt;
 --- LITTLECMS support available&lt;br /&gt;
 --------------------------------------------------------------------&lt;br /&gt;
If you&#039;re missing zlib or jpeg support, install those libraries, too.&lt;br /&gt;
&lt;br /&gt;
If that build shows everything available, test the setup:&lt;br /&gt;
 python selftest.py&lt;br /&gt;
A successful selftest will result in&lt;br /&gt;
 --------------------------------------------------------------------&lt;br /&gt;
 PIL 1.1.7 TEST SUMMARY &lt;br /&gt;
 --------------------------------------------------------------------&lt;br /&gt;
 Python modules loaded from ./PIL&lt;br /&gt;
 Binary modules loaded from ./PIL&lt;br /&gt;
 --------------------------------------------------------------------&lt;br /&gt;
 --- PIL CORE support ok&lt;br /&gt;
 --- TKINTER support ok&lt;br /&gt;
 --- JPEG support ok&lt;br /&gt;
 --- ZLIB (PNG/ZIP) support ok&lt;br /&gt;
 --- FREETYPE2 support ok&lt;br /&gt;
 --- LITTLECMS support ok&lt;br /&gt;
 --------------------------------------------------------------------&lt;br /&gt;
 Running selftest:&lt;br /&gt;
 --- 57 tests passed.&lt;br /&gt;
If all is successful, finally install the library:&lt;br /&gt;
 sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
==== Install NML ====&lt;br /&gt;
Now, that you have installed ply and pil, then you can install NML from the unpacked nml directory:&lt;br /&gt;
 sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing the installation ==&lt;br /&gt;
To verify that everything is installed, enter &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;nmlc --version&amp;lt;/code&amp;gt; in your command line. This should output the version of NML as well as the version of the installed libraries.&lt;br /&gt;
&lt;br /&gt;
Examples for small NML &amp;quot;projects&amp;quot; are found in the &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;examples&amp;lt;/code&amp;gt; and &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;regression&amp;lt;/code&amp;gt; folder of NML. Generally it&#039;s assumed that the language files are in a separate language folder &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;lang&amp;lt;/code&amp;gt;, thus a simple project may look like this:&lt;br /&gt;
&lt;br /&gt;
 mynewgrf.nml&lt;br /&gt;
 graphics.png&lt;br /&gt;
 funny_sound.wav&lt;br /&gt;
 &lt;br /&gt;
 lang/english.lng&lt;br /&gt;
&lt;br /&gt;
The compiler itself &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;nmlc&amp;lt;/code&amp;gt; is a command line tool and can take a number of parameters, at least the nml filename which it shall process, e.g. &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;nmlc mynewgrf.nml&amp;lt;/code&amp;gt; will compile your nml file into the grf-file &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;mynewgrf.grf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The full syntax is:&lt;br /&gt;
&lt;br /&gt;
 Usage: nmlc [options] &amp;lt;filename&amp;gt;&lt;br /&gt;
 Where &amp;lt;filename&amp;gt; is the nml file to parse&lt;br /&gt;
 &lt;br /&gt;
 Options:&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  -d, --debug           write the AST to stdout&lt;br /&gt;
  -s, --stack           Dump stack when an error occurs&lt;br /&gt;
  --grf=&amp;lt;file&amp;gt;          write the resulting grf to &amp;lt;file&amp;gt;&lt;br /&gt;
  --md5=&amp;lt;file&amp;gt;          Write an md5sum of the resulting grf to &amp;lt;file&amp;gt;&lt;br /&gt;
  --nfo=&amp;lt;file&amp;gt;          write nfo output to &amp;lt;file&amp;gt;&lt;br /&gt;
  -M                    output a rule suitable for make describing the&lt;br /&gt;
                        graphics dependencies of the main grf file (requires&lt;br /&gt;
                        input file or --grf)&lt;br /&gt;
  --MF=&amp;lt;file&amp;gt;           When used with -M, specifies a file to write the&lt;br /&gt;
                        dependencies to&lt;br /&gt;
  --MT=&amp;lt;file&amp;gt;           target of the rule emitted by dependency generation&lt;br /&gt;
                        (requires -M)&lt;br /&gt;
  -c                    crop extraneous transparent blue from real sprites&lt;br /&gt;
  -u                    save uncompressed data in the grf file&lt;br /&gt;
  --nml=&amp;lt;file&amp;gt;          write optimized nml to &amp;lt;file&amp;gt;&lt;br /&gt;
  -o &amp;lt;file&amp;gt;, --output=&amp;lt;file&amp;gt;&lt;br /&gt;
                        write output(nfo/grf) to &amp;lt;file&amp;gt;&lt;br /&gt;
  -t &amp;lt;file&amp;gt;, --custom-tags=&amp;lt;file&amp;gt;&lt;br /&gt;
                        Load custom tags from &amp;lt;file&amp;gt; [default:&lt;br /&gt;
                        custom_tags.txt]&lt;br /&gt;
  -l &amp;lt;dir&amp;gt;, --lang-dir=&amp;lt;dir&amp;gt;&lt;br /&gt;
                        Load language files from directory &amp;lt;dir&amp;gt; [default:&lt;br /&gt;
                        lang]&lt;br /&gt;
  --default-lang=&amp;lt;file&amp;gt;&lt;br /&gt;
                        The default language is stored in &amp;lt;file&amp;gt; [default:&lt;br /&gt;
                        english.lng]&lt;br /&gt;
  --start-sprite=&amp;lt;num&amp;gt;  Set the first sprite number to write (do not use&lt;br /&gt;
                        except when you output nfo that you want to include in&lt;br /&gt;
                        other files)&lt;br /&gt;
  -p &amp;lt;palette&amp;gt;, --palette=&amp;lt;palette&amp;gt;&lt;br /&gt;
                        Force nml to use the palette &amp;lt;pal&amp;gt; [default: ANY].&lt;br /&gt;
                        Valid values are &#039;DOS&#039;, &#039;WIN&#039;, &#039;ANY&#039;&lt;br /&gt;
  --quiet               Disable all warnings. Errors will be printed normally.&lt;br /&gt;
  -n, --no-cache        Disable caching of sprites in .cache[index] files,&lt;br /&gt;
                        which may reduce compilation time.&lt;br /&gt;
&lt;br /&gt;
== Syntax highlighting ==&lt;br /&gt;
For a few editors there exist syntax highlighting rules, see the [http://dev.openttdcoop.org/projects/home/documents DevZone documents] for details.&lt;br /&gt;
There are rules for&lt;br /&gt;
* [http://dev.openttdcoop.org/documents/26 Geany]&lt;br /&gt;
* [http://dev.openttdcoop.org/documents/24 Notepad++]&lt;br /&gt;
* [http://dev.openttdcoop.org/documents/38 Kate]&lt;/div&gt;</summary>
		<author><name>Qazzian</name></author>
	</entry>
</feed>