M4nfo installation problem.

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

Moderator: Graphics Moderators

michael blunck
Tycoon
Tycoon
Posts: 5271
Joined: 27 Apr 2005 07:09
Contact:

Re: M4nfo installation problem.

Post by michael blunck » 11 Jan 2018 13:09

Tony Pixel wrote: I didn't think what m4 is bad, I have so many problems with it.
What exactly are your problems with M4?

1) Did you download it? Here´s a pre-compiled version -> http://gnuwin32.sourceforge.net/packages/m4.htm

Make sure that the location where you put it is included in your $PATH var.

Does it work for you? -> run "m4 --version" in a command window. What does it tell?

2) Did you download grfcodec? Here it is -> http://www.openttd.org/en/download-grfcodec

Again, make sure that the location where you put it is included in your $PATH var.

Does it work? run "grfcodec -?" in a command window. What does it tell?

3) Now, download the m4nfo module for "trains" -> http://www.ttdpatch.de/grfspecs/m4nfoMa ... trains.zip

Unzip it, it includes two .m4 files:

- "m4nfo_trains.m4"
This is the "trains module", you have to include it in the command which starts M4:

Code: Select all

M4 -R m4nfo_trains.m4 < test.nfx > test.nfo 
where "test.nfx" is your m4nfo source file and "test.nfo" is the resulting NFO output file for grfcodec (instead of "test", you should use your own file names here!)

- "count.m4"
This is a special m4nfo file which adds real sprite numbers to the resulting nfo code, for trouble shooting:

Code: Select all

copy count.m4 + test.nfo test.tt
This (windows!) command writes "count.m4" and "test.nfo" into a new file "test.tt". And in a second step, is handed over to M4 (again!):

Code: Select all

M4 < test.tt > test.nfo
Now, "test.nfo" contains proper sprite numbers which might be used e.g. by the linter program "nforenum".

The resulting file "test.nfo" can now be fed to grfcodec, together with any graphics, included in file "test.png":

Code: Select all

grfcodec -e test.grf
That´s all.


Eventually, all of the previous commands can be easily put into a batch file, e.g. "train.bat":

Code: Select all

M4 -R m4nfo_trains.m4 < $1.nfx > $1.nfo
copy count.m4 + $1.nfo $1.tt
M4 < $1.tt > $1.nfo
grfcodec -e $1.grf
so the command "train mytest" would produce "mytest.grf" from files "mytest.nfx" and "mytest.png".

The only problem is to set up your directory structure and your PATH var in a proper way so that every file can be found.

HTH
Michael
Image

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

Re: M4nfo installation problem.

Post by Tony Pixel » 11 Jan 2018 15:01

How to set PATH variable?
Image
Sprite artist and NewGRF developer, NML coder. My projects:
Screenshots: New York City Subway Episodes
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Over-sized Train Set | Tony Pixel's Subway Equipment Set

I use GPLv2+ license.

Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4738
Joined: 09 Sep 2007 05:03
Location: home

Re: M4nfo installation problem.

Post by Alberth » 12 Jan 2018 11:38

Tony Pixel wrote:How to set PATH variable?
Search for "windows set PATH", really the Internet knows the answer to most questions.

Random URL from the collection: https://stackoverflow.com/questions/954 ... in-windows
Being a OpenTTD developer does not mean I know what I am doing.
Also, other OpenTTD developers may have different opinions.

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

Re: M4nfo installation problem.

Post by Tony Pixel » 14 Aug 2018 08:11

After many time, I return to this thread, and have an old questions. As You said, I downloaded the grfcodec and set up the PATH variable - added to the end:

Code: Select all

;D:\Anton\grfcodec\
Next, I went to the this page, downloaded and unpacked "m4-1.4.18.tar.gz" archive. Then also added to the PATH variable:

Code: Select all

;D:\Anton\m4nfo\
What to do next? I tried "M4 -R m4nfo_trains.m4 < test.nfx > test.nfo" in cmd, but nothing happened.
Image
Sprite artist and NewGRF developer, NML coder. My projects:
Screenshots: New York City Subway Episodes
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Over-sized Train Set | Tony Pixel's Subway Equipment Set

I use GPLv2+ license.

User avatar
acs121
Tycoon
Tycoon
Posts: 1949
Joined: 03 Nov 2017 18:57
Location: Courbevoie, near Paris, France

Re: M4nfo installation problem.

Post by acs121 » 14 Aug 2018 10:53

Did it send an error or something ?

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

Re: M4nfo installation problem.

Post by Tony Pixel » 14 Aug 2018 10:53

File not found
Image
Sprite artist and NewGRF developer, NML coder. My projects:
Screenshots: New York City Subway Episodes
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Over-sized Train Set | Tony Pixel's Subway Equipment Set

I use GPLv2+ license.

User avatar
acs121
Tycoon
Tycoon
Posts: 1949
Joined: 03 Nov 2017 18:57
Location: Courbevoie, near Paris, France

Re: M4nfo installation problem.

Post by acs121 » 14 Aug 2018 10:55

What file is it talking about ?

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

Re: M4nfo installation problem.

Post by Tony Pixel » 14 Aug 2018 11:49

It simply says "File not found"
Image
Sprite artist and NewGRF developer, NML coder. My projects:
Screenshots: New York City Subway Episodes
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Over-sized Train Set | Tony Pixel's Subway Equipment Set

I use GPLv2+ license.

User avatar
acs121
Tycoon
Tycoon
Posts: 1949
Joined: 03 Nov 2017 18:57
Location: Courbevoie, near Paris, France

Re: M4nfo installation problem.

Post by acs121 » 14 Aug 2018 12:46

Did you open m4nfo correctly by a command file ? You have to right-click on the directory, click on modify the adress and type "cmd" instead of the adress.

Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4738
Joined: 09 Sep 2007 05:03
Location: home

Re: M4nfo installation problem.

Post by Alberth » 15 Aug 2018 06:38

Tony Pixel wrote:After many time, I return to this thread, and have an old questions. As You said, I downloaded the grfcodec and set up the PATH variable - added to the end:

Code: Select all

;D:\Anton\grfcodec\
Next, I went to the this page, downloaded and unpacked "m4-1.4.18.tar.gz" archive. Then also added to the PATH variable:

Code: Select all

;D:\Anton\m4nfo\
What to do next? I tried "M4 -R m4nfo_trains.m4 < test.nfx > test.nfo" in cmd, but nothing happened.
Since you start with "m4", you're trying to run the 'm4' program. Is there an m4 executable either in "D:\Anton\grfcodec\" or in "D:\Anton\m4nfo\" ? (There shouldn't be, since the command failed.)

The next question is then, where did you put the "m4" executable instead?
Given that you donwloaded a GNU package, I would gamble it is in d:\anton\m4-1.4.16\bin\m4 (if you unpacked the m4-1.4.18.tar.gz in d:\anton). If you did, you should also add "d:\anton\m4-1.4.18\bin" to the PATH. (In any case, PATH should contain the directory path of the directory that has the m4 program.)

Note that the PATH is mostly a convenience for you, so you can type "m4" and the computer looks through the directories in the PATH, until it finds an executable with the given name. If you type what to run with a \ in it, the entire PATH resolving is skipped, and it tries to run whatever you typed. ie, if you enter "d:\somewhere\sometime\somehow\bla" at the command-line, it will literally try run the "bla" program at the given path (if it exists), without using the PATH variable.
As such, you can always type the full path of a program to run it (eg "d:\anton\m4-1.4.18\bin\m4 < test.nfx > test.nfo" if d:\anton\m4-1.4.18\bin\m4 exists).
Being a OpenTTD developer does not mean I know what I am doing.
Also, other OpenTTD developers may have different opinions.

Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 1 guest