newgrf - help!

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

Post Reply
User avatar
cmoiromain
Chief Executive
Chief Executive
Posts: 655
Joined: 15 Jan 2007 21:45
Location: FRANCE
Contact:

newgrf - help!

Post 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?
I am little, ugly, and nasty. How do you do?
buttercup
Traffic Manager
Traffic Manager
Posts: 136
Joined: 22 Jan 2007 20:19

Re: newgrf - help!

Post by buttercup »

Edit: Ignore me
Last edited by buttercup on 01 Jan 2009 20:11, edited 1 time in total.
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2897
Joined: 16 May 2007 16:59

Re: newgrf - help!

Post 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...
User avatar
cmoiromain
Chief Executive
Chief Executive
Posts: 655
Joined: 15 Jan 2007 21:45
Location: FRANCE
Contact:

Re: newgrf - help!

Post 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)
Attachments
mygrf.pcx
(2.62 KiB) Downloaded 103 times
I am little, ugly, and nasty. How do you do?
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2897
Joined: 16 May 2007 16:59

Re: newgrf - help!

Post 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?
User avatar
cmoiromain
Chief Executive
Chief Executive
Posts: 655
Joined: 15 Jan 2007 21:45
Location: FRANCE
Contact:

Re: newgrf - help!

Post 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...
Last edited by cmoiromain on 23 Jul 2008 20:29, edited 1 time in total.
I am little, ugly, and nasty. How do you do?
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: newgrf - help!

Post 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
TTDpatch Developer 2005 - 2010 ~ It all started because of shortened vehicle not loading correctly, now look where I've gone with it!
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."
User avatar
cmoiromain
Chief Executive
Chief Executive
Posts: 655
Joined: 15 Jan 2007 21:45
Location: FRANCE
Contact:

Re: newgrf - help!

Post by cmoiromain »

okay, so it's just grfwizzard that forces me to do stuff which are not necessary.
I am little, ugly, and nasty. How do you do?
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2897
Joined: 16 May 2007 16:59

Re: newgrf - help!

Post 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.
User avatar
cmoiromain
Chief Executive
Chief Executive
Posts: 655
Joined: 15 Jan 2007 21:45
Location: FRANCE
Contact:

Re: newgrf - help!

Post by cmoiromain »

yes, but if I only put 00 as the name, how will it appear in the list?
I am little, ugly, and nasty. How do you do?
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2897
Joined: 16 May 2007 16:59

Re: newgrf - help!

Post by Zephyris »

Probably as a blank line but i'm not sure, I would put a name in!
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: newgrf - help!

Post 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
TTDpatch Developer 2005 - 2010 ~ It all started because of shortened vehicle not loading correctly, now look where I've gone with it!
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."
User avatar
cmoiromain
Chief Executive
Chief Executive
Posts: 655
Joined: 15 Jan 2007 21:45
Location: FRANCE
Contact:

Re: newgrf - help!

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

Now I can start practising on more complicated stuff =)
Attachments
mygrf.grf
my very first grf, with company color =)
(1.1 KiB) Downloaded 87 times
I am little, ugly, and nasty. How do you do?
User avatar
stevenh
TTDPatch Developer
TTDPatch Developer
Posts: 759
Joined: 24 Jul 2005 05:07
Location: Canberra, Australia
Contact:

Re: newgrf - help!

Post by stevenh »

Just go here and attempt to upload and edit your GRF...

it ...might... just work...

heh. :twisted:
User avatar
cmoiromain
Chief Executive
Chief Executive
Posts: 655
Joined: 15 Jan 2007 21:45
Location: FRANCE
Contact:

Re: newgrf - help!

Post by cmoiromain »

wow this website kicks ass!
I am little, ugly, and nasty. How do you do?
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Google [Bot] and 8 guests