Transport Tycoon Forums
https://www.tt-forums.net/

M4nfo installation problem.
https://www.tt-forums.net/viewtopic.php?f=68&t=82412
Page 2 of 2

Author:  michael blunck [ Thu Jan 11, 2018 1:09 pm ]
Post subject:  Re: M4nfo installation problem.

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:
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:
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:
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:
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:
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

Author:  Tony Pixel [ Thu Jan 11, 2018 3:01 pm ]
Post subject:  Re: M4nfo installation problem.

How to set PATH variable?

Author:  Alberth [ Fri Jan 12, 2018 11:38 am ]
Post subject:  Re: M4nfo installation problem.

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

Author:  Tony Pixel [ Tue Aug 14, 2018 8:11 am ]
Post subject:  Re: M4nfo installation problem.

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:
;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:
;D:\Anton\m4nfo\

What to do next? I tried "M4 -R m4nfo_trains.m4 < test.nfx > test.nfo" in cmd, but nothing happened.

Author:  acs121 [ Tue Aug 14, 2018 10:53 am ]
Post subject:  Re: M4nfo installation problem.

Did it send an error or something ?

Author:  Tony Pixel [ Tue Aug 14, 2018 10:53 am ]
Post subject:  Re: M4nfo installation problem.

File not found

Author:  acs121 [ Tue Aug 14, 2018 10:55 am ]
Post subject:  Re: M4nfo installation problem.

What file is it talking about ?

Author:  Tony Pixel [ Tue Aug 14, 2018 11:49 am ]
Post subject:  Re: M4nfo installation problem.

It simply says "File not found"

Author:  acs121 [ Tue Aug 14, 2018 12:46 pm ]
Post subject:  Re: M4nfo installation problem.

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.

Author:  Alberth [ Wed Aug 15, 2018 6:38 am ]
Post subject:  Re: M4nfo installation problem.

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:
;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:
;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).

Page 2 of 2 All times are UTC
Powered by phpBB © 2000-2018 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2018.