M4nfo installation problem.

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

Moderator: Graphics Moderators

Tony Pixel
Route Supervisor
Route Supervisor
Posts: 459
Joined: 14 Oct 2017 11:06
Location: Ukraine

M4nfo installation problem.

Post by Tony Pixel »

Can anyone explain me how to install modules in m4nfo and how to start the work. I'm already have code with m4 syntax, but I don't know how to create newGRF.
Image Image
Sprite artist and NewGRF developer, coding in NML. My projects:
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Tony Pixel's Subway Equipment Set (frozen)
Screenshots: New York City Subway Episodes
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: M4nfo installation problem.

Post by Alberth »

Never worked with m4nfo, but presumably it uses m4 to convert the source to NFO.

m4 is macro processor, that you can find at many Unix systems. Alternatively, you can use a port like MingW which should include m4 as well. (Not checked nor tested, as I don't have a Windows system.) Another option is running Ubuntu natively at Windows 10, which was introduced by Microsoft recently. If that is not enough, a search like "m4 Windows" will likely give you some other starting points.

By running m4 on the grf source, you should get an NFO file. That file can be processed by grfcodec, the standard tool for creating GRFs from NFO.
Being a retired OpenTTD developer does not mean I know what I am doing.
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: M4nfo installation problem.

Post by michael blunck »

Tony Pixel wrote:Can anyone explain me how to install modules in m4nfo and how to start the work. I'm already have code with m4 syntax, but I don't know how to create newGRF.
Did you check out this page?

HTH
Michael
Image
Tony Pixel
Route Supervisor
Route Supervisor
Posts: 459
Joined: 14 Oct 2017 11:06
Location: Ukraine

Re: M4nfo installation problem.

Post by Tony Pixel »

michael blunck wrote: Did you check out this page?
Yes, but I didn't know where enter these commands and which test.nfx use. Michael, can you pm me and explain all steps?
Image Image
Sprite artist and NewGRF developer, coding in NML. My projects:
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Tony Pixel's Subway Equipment Set (frozen)
Screenshots: New York City Subway Episodes
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: M4nfo installation problem.

Post by Alberth »

You enter text commands normally in the command program that comes with Windows. If you downloaded a Unix version like MingW, it comes with a shell named bash or sh which does the same thing.

test.nfx is the input file of m4, ie the main file of your grf source
Being a retired OpenTTD developer does not mean I know what I am doing.
Tony Pixel
Route Supervisor
Route Supervisor
Posts: 459
Joined: 14 Oct 2017 11:06
Location: Ukraine

Re: M4nfo installation problem.

Post by Tony Pixel »

Where I must create these file? I'm already have code text and sprites.
Image Image
Sprite artist and NewGRF developer, coding in NML. My projects:
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Tony Pixel's Subway Equipment Set (frozen)
Screenshots: New York City Subway Episodes
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: M4nfo installation problem.

Post by michael blunck »

Tony Pixel wrote: Where I must create these file? I'm already have code text and sprites.
Well, depends. For every set you should create a "working directory" with all the needed files, code and sprites.

Are you on windows or on Unix/OSX?
What TTD feature is your GRF for? trains? rvs? stations? objects? ...
Did you install the proper m4nfo module for that feature?
Did you install M4?
Did you install grfcodec?
Did you set path variables to use M4 and grfcodec from your working directory?
Do you really want to type in single commands, or do you want to use a batch file, or do you even want to use "make"?
...

regards
Michael
Image
Tony Pixel
Route Supervisor
Route Supervisor
Posts: 459
Joined: 14 Oct 2017 11:06
Location: Ukraine

Re: M4nfo installation problem.

Post by Tony Pixel »

michael blunck wrote:
Tony Pixel wrote: Where I must create these file? I'm already have code text and sprites.
Well, depends. For every set you should create a "working directory" with all the needed files, code and sprites.

Are you on windows or on Unix/OSX?
What TTD feature is your GRF for? trains? rvs? stations? objects? ...
Did you install the proper m4nfo module for that feature?
Did you install M4?
Did you install grfcodec?
Did you set path variables to use M4 and grfcodec from your working directory?
Do you really want to type in single commands, or do you want to use a batch file, or do you even want to use "make"?
...

regards
Michael
I'm already have work directory;
My GRF is a train set for ~20 vehicles;
I'm already instal grfcodec and M4, but I don't understand how to install module, path variables and what the difference have "make", batch
files and commands.
Image Image
Sprite artist and NewGRF developer, coding in NML. My projects:
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Tony Pixel's Subway Equipment Set (frozen)
Screenshots: New York City Subway Episodes
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: M4nfo installation problem.

Post by michael blunck »

Tony Pixel wrote: [...] I don't understand how to install module, path variables and what the difference have "make", batch files and commands.
You need to use the shell (command line interpreter) to enter commands (or running batch files including such commands) by use of the keyboard.

I.e., entering

Code: Select all

M4 -R m4nfo_trains.m4 < test.nfx > test.nfo
would start M4 using the m4nfo trains module, and translate file "test.nfx" (your m4nfo source code) into file "test.nfo" (nfo code).

Likewise, you might also start grfcodec from the shell.

O/c, the better solution would be to use a batch file like this:

Code: Select all

M4 -R m4nfo_trains.m4 < test.nfx > test.nfo
copy count.m4 + test.nfo test.tt
M4 < test.tt > test.nfo
grfcodec -e test.grf
to produce a nfo file from your m4nfo source, add valid sprite numbers by using count.m4, and start grfcodec to assemble the final GRF from files test.nfo (resulting nfo code) and test.png (your graphics). Note that above example is for windows.

HTH
Michael
Image
Tony Pixel
Route Supervisor
Route Supervisor
Posts: 459
Joined: 14 Oct 2017 11:06
Location: Ukraine

Re: M4nfo installation problem.

Post by Tony Pixel »

Thanks. One small question: where I must set trains module?
Image Image
Sprite artist and NewGRF developer, coding in NML. My projects:
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Tony Pixel's Subway Equipment Set (frozen)
Screenshots: New York City Subway Episodes
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: M4nfo installation problem.

Post by michael blunck »

Tony Pixel wrote: One small question: where I must set trains module?
Where it can be found by M4, depending on your path settings.

E.g., for my DBXL train set, directory structure is like this:

Code: Select all

- m4nfo (modules)
- newvehicles
-- DBXL09 (dbxl.m4, names.m4, templates, dbxl09*.grf)
--- sprites (bmp, png, nfx and nfo files)
I.e., the nfx source file(s) will start with something like

Code: Select all

include(dbxl.m4)
include(dbxl_templates.m4)
include(names.m4)

setfeature(_TRAIN)
setpath(C:\eigene~1\mb\ttdlx\sprites\newvehicles\DBXL09\sprites)
depending on directory structure.

HTH
Michael
Image
Tony Pixel
Route Supervisor
Route Supervisor
Posts: 459
Joined: 14 Oct 2017 11:06
Location: Ukraine

Re: M4nfo installation problem.

Post by Tony Pixel »

Oh, I don't understand anything:
-I loaded m4nfo source from http://ftp.gnu.org/gnu/m4/ (1.4.18);
-I created dir D:\m4nfo and loaded files from arhive;
-I downloaded m4nfo_trains and loaded files from arhive to dir too;
-Now I go at cmd and type :

Code: Select all

M4 -R m4nfo_trains.m4 < test.nfx > test.nfo
but system "can't find the file";
What I made wrong?
Image Image
Sprite artist and NewGRF developer, coding in NML. My projects:
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Tony Pixel's Subway Equipment Set (frozen)
Screenshots: New York City Subway Episodes
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: M4nfo installation problem.

Post by Alberth »

Tony Pixel wrote:-I loaded m4nfo source from http://ftp.gnu.org/gnu/m4/ (1.4.18);
That looks wrong, gnu,org is not distributing m4nfo, that code is distributed by michael blunck.

gnu.org does host the M4 project, a generic macro processor, that is used by micheal for converting m4nfo to nfo. That is, m4nfo is a set macro's for m4. "m4" and "m4nfo" are very different things!

However, "host a project" means they maintain the source code of M4. That is also what they distribute, by the looks of it, or did they include a "m4.exe" or "m4.com" file?
You can create an m4.exe from that source code (probably), but you likely need a C compiler for that.

You better find an m4 executable, eg at mingw, but there may be others, as I said a few posts ago.

[quote="Tony Pixel"-Now I go at cmd and type :

Code: Select all

M4 -R m4nfo_trains.m4 < test.nfx > test.nfo
but system "can't find the file";
Which file? There are 4 files named in that line. Please be precise. My guess is "M4", but don't know without proper error message.


Try stating the full path to m4.exe as first argument (and if you have spaces in that path, surround it with double quotes, or change it to a path without spaces!!)


EDIT: Start with getting a version number from m4, with "m4 --version".
That should give something like

Code: Select all

m4 (GNU M4) 1.4.17
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Rene' Seindal.
If that works, you know you can execute m4. Then work on using it for running m4nfo.
Being a retired OpenTTD developer does not mean I know what I am doing.
Tony Pixel
Route Supervisor
Route Supervisor
Posts: 459
Joined: 14 Oct 2017 11:06
Location: Ukraine

Re: M4nfo installation problem.

Post by Tony Pixel »

Ok, where I can download m4NFO?
P.S. I haven't file test.nfx.
Image Image
Sprite artist and NewGRF developer, coding in NML. My projects:
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Tony Pixel's Subway Equipment Set (frozen)
Screenshots: New York City Subway Episodes
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: M4nfo installation problem.

Post by michael blunck »

Tony Pixel wrote: Ok, where I can download m4NFO?
P.S. I haven't file test.nfx.
You told me that you checked out this page which explains where and how to download the needed software.

"test.nfx" is just a placeholder in the example given above. In fact, it is your m4nfo source file, which you may name whatever you like.

HTH
Michael
Image
rowdog
Engineer
Engineer
Posts: 67
Joined: 24 May 2017 12:51
Location: East Texas

Re: M4nfo installation problem.

Post by rowdog »

I think there's some confusion here because that install.html page doesn't actually link to any downloads. I would start with the top level manual,
http://www.ttdpatch.de/grfspecs/m4nfoManual/
and work through the installation pages.

For convience, the page with download links for the tools is http://www.ttdpatch.de/grfspecs/m4nfoManual/Basic.html
The m4nfo downloads are at http://www.ttdpatch.de/grfspecs/m4nfoMa ... nload.html
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: M4nfo installation problem.

Post by michael blunck »

rowdog wrote: I think there's some confusion here [...]
Thanks, you´re definitely right. I did link to said page since the OP initially reported about having problems with "installing" and how to "start the work":
Tony Pixel wrote: Can anyone explain me how to install modules in m4nfo and how to start the work
and later reported problems with "entering commands", etc.

In fact, it seems that he has more problems than with a proper installation. Hopefully now the given links will be of any help.

regards
Michael
Image
Tony Pixel
Route Supervisor
Route Supervisor
Posts: 459
Joined: 14 Oct 2017 11:06
Location: Ukraine

Re: M4nfo installation problem.

Post by Tony Pixel »

I think is better if I will learn NML.
Image Image
Sprite artist and NewGRF developer, coding in NML. My projects:
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Tony Pixel's Subway Equipment Set (frozen)
Screenshots: New York City Subway Episodes
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: M4nfo installation problem.

Post by michael blunck »

Tony Pixel wrote: I think is better if I will learn NML.
Good luck with installing all the Python stuff and with the usual make problems.

regards
Michael
Image
Tony Pixel
Route Supervisor
Route Supervisor
Posts: 459
Joined: 14 Oct 2017 11:06
Location: Ukraine

Re: M4nfo installation problem.

Post by Tony Pixel »

michael blunck wrote:
Tony Pixel wrote: I think is better if I will learn NML.
Good luck with installing all the Python stuff and with the usual make problems.

regards
Michael
I didn't think what m4 is bad, I have so many problems with it.
Image Image
Sprite artist and NewGRF developer, coding in NML. My projects:
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Tony Pixel's Subway Equipment Set (frozen)
Screenshots: New York City Subway Episodes
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 4 guests