Page 1 of 1
newgrf - help!
Posted: 22 Jul 2008 00:34
by cmoiromain
Hi all
After a long hesitation, I finally decided to learn (or at least to begin learning) nfo coding, using the wiki tutorial. Here is mygrf.nfo:
Code: Select all
// Automatically generated by GRFCODEC. Do not modify!
// (Info version 7)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
0 * 4 0D 00 00 00
1 * 8 08 06 "RG" 02 04 00 00
2 * 4 01 00 01 08
3 c:\program files\ttdx\sprites/mygrf.pcx 18 8 01 18 8 -3 -10
4 c:\program files\ttdx\sprites/mygrf.pcx 34 8 09 15 20 -14 -6
5 c:\program files\ttdx\sprites/mygrf.pcx 66 8 01 12 28 -14 -6
6 c:\program files\ttdx\sprites/mygrf.pcx 114 8 09 16 20 -4 -8
7 c:\program files\ttdx\sprites/mygrf.pcx 146 8 01 18 8 -3 -10
8 c:\program files\ttdx\sprites/mygrf.pcx 162 8 09 16 20 -14 -7
9 c:\program files\ttdx\sprites/mygrf.pcx 194 8 01 12 28 -14 -6
10 c:\program files\ttdx\sprites/mygrf.pcx 242 8 09 15 20 -4 -7
11 * 9 02 00 00 01 01 00 00 00 00
12 * 7 03 00 01 16 00 00 00
13 * 7 00 00 01 01 16 12 FD
mygrf.pcx exists and works in the correct directory, yet grfcodec keeps repeating me:
Error opening c:\program files\ttdx\sprites''/mygrf.nfo: Invalid argument
what have I done wrong?
Re: newgrf - help!
Posted: 22 Jul 2008 01:11
by buttercup
Edit: Ignore me
Re: newgrf - help!
Posted: 22 Jul 2008 01:41
by Zephyris
c:\program files\ttdx\sprites''/mygrf.nfo: Invalid argument
It looks like you are entering "grfcodec -e "/mygrf.nfo" when you just need to use "grfcodec -e mygrf". Grfcodec by default looks for the .nfo file in the sprites subfolder...
Re: newgrf - help!
Posted: 22 Jul 2008 14:33
by cmoiromain
I don't use grfcodec alone, I use grf wizard. For the / instead of \, that just appeared on its own when I decoded the initial grf...
How is it possible to use grfcodec without grf wizard? When I double click the grfcodec.exe, a cmd windows opens and immediately closes, with nothing happening... and I haven't found any help as to how it works...
edit:
now some change: here is what I get (I just moved the location of the output grf to the same directory as the nfo & pcx files)
Encoding in temporary file c:\ program files\ttdx\sprites\mygrf.new
Loading c:\program files\ttdx\sprites/mygrf.pcxarency:100%, Redundancy:100%)
Error: Unrecognized palette, aborting.
Specify -f on the command line to override this check.
Linked is my (very ugly) pcx file. Since I have no software to draw directly a pcx file, I use Easy Graphic Converter 1.2 to convert from a bmp to a pcx. On the bmp file, I only use the colors from Oskar Eisemuth's palette picture (downloaded on the wiki)
Re: newgrf - help!
Posted: 22 Jul 2008 15:51
by Zephyris
First make sure you have a copy of grfcodec in the \data folder of your installation, simply and copy and paste it there.
You have to run grfcodec as a dos-style command prompt:
1. Press "[windows key]+R"
2. Type "cmd" and press enter (this opens the command prompt).
3. Navigate to the \data folder of your OpenTTD installation by typing "cd C:\[installation path]\data" and pressing enter.
Then you can use the following commands to encode/decode your grfs:
"grfcodec -e <grfname>" - encode target GRF.
"grfcodec -d -p 2 <grfname>.grf" - decode target GRF with windows palette.
"grfcodec -d -p 1 <grfname>.grf" - decode target GRF with DOS palette.
This assumes all your .pcx and .nfo files are in a \sprites subfolder of \data.
Does that help?
Re: newgrf - help!
Posted: 23 Jul 2008 20:11
by cmoiromain
oh so the grfcodec has to be in the /data dir of my installation?
And btw, does grfcodec only work with TTDpatch, or is there a way of making it work with OpenTTD? Would make life easier for me.
And also, the problem of having grfcodec in my TTDpatch installation dir is that the thing keeps telling me the path can't have any spaces in it, so I placed it directly in C:
EDIT:
Thanks for the advice, I managed to make grfcodec work with a DOS command.
Now the problem seems to be with the palette in the pcx file... at least that's what grfcodec says. I tried using -f in the command; the encoding worked to the end, but the grf file doesn't appear in the grf list. btw, what name is it supposed to have in the list? will it be mygrf.grf, since I didn't define any particular name in the nfo, jst 00...
Re: newgrf - help!
Posted: 23 Jul 2008 20:24
by Lakie
Grfcodec is a completely standalone tool, it does not require TTDpatch or OpenTTD to function.
[Edit] As for spaces, for windows put "s around the path and file name, for example "C:\Transport Tycoon\trg1r.grf".
~ Lakie
Re: newgrf - help!
Posted: 23 Jul 2008 20:30
by cmoiromain
okay, so it's just grfwizzard that forces me to do stuff which are not necessary.
Re: newgrf - help!
Posted: 23 Jul 2008 21:39
by Zephyris
Try copying the pcx file into a pcx with the correct palette (eg. decode trtg1r.grf with "grfcodec -d -p 2 trtg1r.grf" for the windows palette) then resaving. As for the GRF name the file name is taken from the source .nfo, in the grf list the name appears as defined by the action8.
Re: newgrf - help!
Posted: 23 Jul 2008 21:42
by cmoiromain
yes, but if I only put 00 as the name, how will it appear in the list?
Re: newgrf - help!
Posted: 23 Jul 2008 22:02
by Zephyris
Probably as a blank line but i'm not sure, I would put a name in!
Re: newgrf - help!
Posted: 23 Jul 2008 22:16
by Lakie
cmoiromain wrote:okay, so it's just grfwizzard that forces me to do stuff which are not necessary.
I'd generally advise against using grfwizzard as its very old and doesn't support quite a few newer features of GrfCodec, also it has a few issues with paths as you may have noticed.
~ Lakie
Re: newgrf - help!
Posted: 24 Jul 2008 02:08
by cmoiromain
that's it, I've finally got my thing working (nearly!!!)
Attached are the nfo, the pcx and the grf.
To create the grf, I had to use the -f in the grfcodec command (dunno what it does exactly, but it ceased the buggering about the palette problem)
I still have a transparency problem (that damned blue won't go away!)
Also, I am still wondering how the hell this palette thing works.
I found on an old topic the TTD palettes for the GIMP (which I downloaded for the occasion)
However, I can't figure out how it works to place a palette within the software, how to load it, and how to select colours from it while you are drawing...
Please, could someone clever and experienced help me with this palette thing, and also could look at and maybe correct my pcx file? the blue should be transparent, apart from that everything works fine (I even got the company colour working for the roof of the driving cabin ^^ )
Good night
EDIT:
after fiddling around with various tools, I finally got transparency to work! I still get that error with grfcodec, but never mind! the damn thing finally work, attached is the proof
Now I can start practising on more complicated stuff =)
Re: newgrf - help!
Posted: 24 Jul 2008 04:52
by stevenh
Just go
here and attempt to upload and edit your GRF...
it ...might... just work...
heh.

Re: newgrf - help!
Posted: 24 Jul 2008 05:14
by cmoiromain
wow this website kicks ass!