DJ Nekkids & Bennythen00b's NFO lessons

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

Moderator: Graphics Moderators

DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by DaleStan »

Bennythen00b wrote:

Code: Select all

grfcodec -e -c buffers_Onlytemperate.nfo -f
Item 1: You encode a GRF, not an NFO.
Item 2: You must not use -f if you want me to look at your files.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
Benny
Tycoon
Tycoon
Posts: 2185
Joined: 25 Aug 2007 17:03
Location: ~/

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by Benny »

I am just following PikkaBird's tutorial!
And I refuse to code with that @ECHO stuff..
Image
User avatar
Ammler
President
President
Posts: 953
Joined: 18 Jun 2006 18:18
Location: Switzerland
Contact:

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by Ammler »

DaleStan wrote: Item 1: You encode a GRF, not an NFO.
I am wondering, why grfcodec does support encoding *.nfo. ;-)
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by DaleStan »

Bennythen00b wrote:I am just following PikkaBird's tutorial!
Even if Pikka's tutorial says to use -f, which it doesn't, you still must not use -f if you want me to look at your files.
Ammler wrote:I am wondering, why grfcodec does support encoding *.nfo.
In fact, it does. But I do not guarantee that it will continue to work.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5602
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by PikkaBird »

Ammler wrote:
DaleStan wrote: Item 1: You encode a GRF, not an NFO.
I am wondering, why grfcodec does support encoding *.nfo. ;-)
It makes more sense to me that you give grfcodec the name of the file you want it to read, rather than the name of some file that doesn't exist yet and which has only a tenuous relationship to the name of the file you want it to read. I'll stick with it as long as it works...

Anyway, Benny, you probably need to make sure that the filename is correct in the batch file. The reason you "had to" rename the pcx is because that's what it says the pcx is called in the nfo. You know you can run batch files from a command prompt too, right?
User avatar
Benny
Tycoon
Tycoon
Posts: 2185
Joined: 25 Aug 2007 17:03
Location: ~/

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by Benny »

The grf actually encodes, but it ends up with pink colors.

PikkaBird wrote:Anyway, Benny, you probably need to make sure that the filename is correct in the batch file.
It is.
PikkaBird wrote:You know you can run batch files from a command prompt too, right?
Yes, I do.
DaleStan wrote:Even if Pikka's tutorial says to use -f, which it doesn't, you still must not use -f if you want me to look at your files.
Sure, how should I do it then?
Image
User avatar
Benny
Tycoon
Tycoon
Posts: 2185
Joined: 25 Aug 2007 17:03
Location: ~/

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by Benny »

I just removed "-f" and used .grf instead of ".nfo" in the coding process like you told me to. But now GRFCodec sais this:

Edit: GAH! Sorry about .JPG..
Attachments
GRFCodec - error.jpg
GRFCodec - error.jpg (47.1 KiB) Viewed 2195 times
Image
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by DaleStan »

Bennythen00b wrote:But now GRFCodec sais this:
That would be because the palette in your PCX is incorrect. 8-bit indexed is necessary but not sufficient. Unless you know what you are doing (or are generating a DOS GRF, in which case you must use the palette from a DOS decoding), you must use exactly the palette that grfcodec generates when decoding a Windows GRF. "Exactly" means that you must have the same colors and they must be in the same order.

Also, grfcodec has already complained about this: "Warning: Encoding despite unrecognized palette."
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
Benny
Tycoon
Tycoon
Posts: 2185
Joined: 25 Aug 2007 17:03
Location: ~/

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by Benny »

I did not add or remove one single pixel. I just copy/pasted the temperate tunnels over the arctic ones.
Image
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5602
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by PikkaBird »

Bennythen00b wrote:I did not add or remove one single pixel. I just copy/pasted the temperate tunnels over the arctic ones.
The palette in your pcx is all over the place. Obviously your graphics program is doing something funny to it.
User avatar
Benny
Tycoon
Tycoon
Posts: 2185
Joined: 25 Aug 2007 17:03
Location: ~/

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by Benny »

So what program should I use?
Image
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by DJ Nekkid »

i use i.mage, not sure what other people use.
Member of the
ImageImage
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by Lakie »

I use the GIMP and before that Photo Impact, both can work the TTD palette quite happily, note that in the former case you need to set a few options when converting the image to palette.
If you don't want to change program I suggest you look at the various options when converting / applying palettes to images (or read the help files about it).

~ 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."
javaguy
Engineer
Engineer
Posts: 76
Joined: 29 Mar 2006 13:08

Creating matching carriages with Action 3 - NFO Coding

Post by javaguy »

Hi,

First off aplogies if this shouldn't be in graphics but I assume NFO coding comes under graphics.

A little while ago I came along here asking if a certain train (class 465) existed in TTDX. The answer was no and I drew one (not great, granted) but never got around to trying to get it to show up in TTD. Well I've started, even if I am 2 years late :p I feel like I'm sloooooooowly getting the hang of NFO editing. Anyway, I got the train to show up in TTDX & set most of the properties but have become slightly unstuck attempting to make carriages match the EMU itself, since the TTDPatch site's tutorial is one big TODO :p My problem is essentially that if I try the code below nothing happens. The Dash DMU shows up as normal in the electric trains menu. Only after rolling back all my changes did I get the 465 to show up again

As I understand it I need to do the following

1.) Action 1, say that we have 2 seperate sets, 1 with eight views, 1 with four.
2.) <sprites>
3.) action 2, make a real sprite from the carriage ones
4.) action 3, override the carriage livery with the action 2 ID

Does this look anywhere near correct? I'm assuming that it IS possible to get carriages to change appearance when attached to a certain train, maybe I misunderstood the purpose of the livery override.

Anyway, here's the code I have so far, I've added some annotations to show what I'm trying to do :p

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 7)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
    0 * 04	 15 00 00 00
    1 * 39	 08 07 "TV" 00 01 02 "Class 465" 00 "Class 465 Description" 00
    2 * 04	 01 00 01 08 --EMU sprites
    3 sprites/465s.pcx 66 8 01 18 8 -3 -10
    4 sprites/465s.pcx 82 8 09 16 20 -14 -7
    5 sprites/465s.pcx 114 8 01 12 28 -14 -6
    6 sprites/465s.pcx 162 8 09 16 20 -4 -8
    7 sprites/465s.pcx 194 8 01 18 8 -3 -10
    8 sprites/465s.pcx 210 8 09 16 20 -14 -7
    9 sprites/465s.pcx 242 8 01 12 28 -14 -6
   10 sprites/465s.pcx 290 8 09 16 20 -4 -8
   11 * 04	 01 00 02 04 --carriage sprites
   12 sprites/465s.pcx 322 8 01 18 8 -3 -10
   13 sprites/465s.pcx 338 8 09 16 20 -14 -7
   14 sprites/465s.pcx 370 8 01 12 28 -14 -6
   15 sprites/465s.pcx 418 8 09 16 20 -4 -8
   16 * 9	 02 00 00 01 01 00 00 00 00 -- train sprite
   17 * 9        02 00 01 02 02 01 01 01 01 --carriage sprite
   18 * 9	 03 00 01 0C 00 00 00 00 00 -- add new GFX to Dash DMU
   19 * 7        03 00 81 1B 00 01 00 --livery override of carriages attached to the train
   20 * 16	 00 00 05 01 0C 15 00 14 AE 09 48 00 22 40 19 28
   21 * 7	 00 00 01 01 0C 12 FD
and here's the code that actually works but without livery override

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 7)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
    0 * 04	 0F 00 00 00
    1 * 27	 08 07 "TV" 00 01 02 "Class 465" 00 "Class 465" 00
    2 * 04	 01 00 01 08
    3 sprites/465s.pcx 66 8 01 18 8 -3 -10
    4 sprites/465s.pcx 82 8 09 16 20 -14 -7
    5 sprites/465s.pcx 114 8 01 12 28 -14 -6
    6 sprites/465s.pcx 162 8 09 16 20 -4 -8
    7 sprites/465s.pcx 194 8 01 18 8 -3 -10
    8 sprites/465s.pcx 210 8 09 16 20 -14 -7
    9 sprites/465s.pcx 242 8 01 12 28 -14 -6
   10 sprites/465s.pcx 290 8 09 16 20 -4 -8
   11 * 9	 02 00 00 01 01 00 00 00 00
   12 * 9        02 00 01 02 02 01 01 01 01
   13 * 7	 03 00 01 0C 00 00 00
   14 * 21	 00 00 07 01 0C 15 00 14 AE 09 48 00 22 40 19 28 0B 48 06 16 44
   15 * 7	 00 00 01 01 0C 12 FD
So, yeah, am I doing something unbelievably wrong? Its kind of hard to know with so little debug info and no tutorials :p
I like TTDX :)
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 988
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: Creating matching carriages with Action 3 - NFO Coding

Post by frosch »

There is only one action1 active at a time. So starting from the point where you define the second action1, you cannot use the sprites from the first one anymore.

So basically you need them in the order:

Action1 for engine
Sprites for engine
Action2 for engine
Action1 for wagon
Sprites for wagon
Action2 for wagon
Action3 for engine
Action3(livery override) for wagon

You will also need to specify different "cargo ids" in the action2 so you can reference them in the action3s.

Generally you should get hold of a copy of nforenum and grf2html (both are on this forum). The former will help you write valid code, and the latter will help you understand what your code does or what code of others does. Esp. it will help you to understand the linking between action3->2->1
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
javaguy
Engineer
Engineer
Posts: 76
Joined: 29 Mar 2006 13:08

Re: Creating matching carriages with Action 3 - NFO Coding

Post by javaguy »

First off, thanks for the quick reply!

I reorganised the NFO file and downloaded nforenum & grftohtml. Using grftohtml helped me to fix a few things and the output does seem to tally with what I think should happen (i.e. the livery override Action3 links to the correct Action2. Sadly I still get the default Dash DMU showing up in the Electric Loco selection window.

I got on slightly less well with nforenum (blame my relative inexperience with a DOS prompt). At first I assumed you typed in the file you wanted it to check but that evidently isn't the case so I pasted in the NFO file, which didn't seem to generate any particular output.

Am I doing something wrong with NFORenum? I was rather hoping for a text file listing some errors or at least a little text doc explaining how to use it. A poke about the thread didn't seem to yield any sort of instruction document either.
I like TTDX :)
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Creating matching carriages with Action 3 - NFO Coding

Post by planetmaker »

javaguy wrote: Am I doing something wrong with NFORenum? I was rather hoping for a text file listing some errors or at least a little text doc explaining how to use it. A poke about the thread didn't seem to yield any sort of instruction document either.
Obviously you fail to find the built-in documentation as the documentation which comes along with renum:

Code: Select all

/nforenum ingo$ ls *doc
AUTO_CORRECT.cz.txt     COMMANDS.cz.txt         README.RPN.cz.txt       README.cz.txt           SANITY.cz.txt
AUTO_CORRECT.en.txt     COMMANDS.en.txt         README.RPN.en.txt       README.en.txt           SANITY.en.txt
/nforenum ingo$ cat doc/README.en.txt
(...)
Usage
=====

To renumber NFO files (for example MyGRF1.NFO and MyGRF2.NFO), use

 > renum [options] MyGRF1 MyGRF2

(Run renum -? or renum --help for a list of command line options.)

(...)
/nforenum ingo$ renum -h
NFORenum v3.4.6 r2191E - Copyright 2004-2009 Dale McCoy.
renum: unrecognized option `-h'
Usage: renum [options] [file1 [file2 [file3 [...]]]]
   Any number of files may be specified.
   If no files or options are specified, NFORenum will read a file from
   standard input and write it to standard output.
Options:
   --comments=<type> -c <type>
       <type> is one character, either /, ;, or #, and specifies the comment
       style that NFORenum will use. This will not change the header, because
       grfcodec requires that the header be commented in C++-style.
   --data[=<dir>] -D[<dir>]
       If <dir> is specified, look for the .renum directory in <dir>, and
       create it if not found.
       If <dir> is not specified, report the location of the .renum directory.
       In either case, eliminate the 5-second wait used to ensure that those
       not running NFORenum from a command line can see the directory-created
       message.
       Default: Look for  the .renum directory in the current directory, and
       then in the environment variable HOME, if defined. If not found attempt
       to create in HOME, then in .
   --force -f
       Forces processing of files that do not look like NFO files.
       The default is to treat such files as if they specified a too-high info
       version.
   --help -?
       Display this message.
   --lock
       Locks the current comment command state. Commands will continue to be
       parsed as normal (so NOPRESERVE will be honored, @@DIFF will be
       removed, &c.) but their changes (such as turning on the diff-assister)
       will not be honored.
   --no-replace --keep-old -k
       Do not replace the old NFO file; write new file to file.new.nfo.
       Default: Use file[.nfo].new as temporary, rename it to file[.nfo]
       when done.
   --auto-correct -a
       Perform some rudimentary automatic correction of incorrect pseudo
       sprites. This may be specified twice to enable the corrections that
       are more likely to be incorrect.
       See the README for detailed information on the auto-correcter.

The following options cause NFORenum to behave as if all files started with
the associated command. The readme has full details on the comment commands.
Options associated with comment commands that require additional information
take that information as an argument. With the exception of -L/--let, the
options to the command line versions are case insensitive.
"ON" and "OFF" may be specified with "+" and "-", respectively.
   --beautify -b               @@BEAUTIFY
   --diff -d                   @@DIFF
   --let -L                    @@LET
   --lint -l                   @@LINT
   --preserve-messages -p      @@PRESERVEMESSAGES
   --real-sprites -r           @@REALSPRITES
   --use-old-nums -o           @@USEOLDSPRITENUMS
   --warning-disable -w        @@WARNING DISABLE
   --warning-enable -W         @@WARNING ENABLE
       -w and -W (and their long counterparts) also accept a comma-separated
       list of messages, all of which will be ENABLEd or DISABLEd.

NFORenum is Copyright 2004-2009 by Dale McCoy (dalestan@gmail.com)
Portions Copyright 2006 Dan Masek
You may copy and redistribute it under the terms of the GNU General Public
License, as stated in the file 'COPYING'.

If this message scrolls by too quickly, you may want to try
   renum -? | more
Leave out the file extension.
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: Creating matching carriages with Action 3 - NFO Coding

Post by DJ Nekkid »

not tested, but i think this should work:

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 7)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
    0 * 04    15 00 00 00
    1 * 39    08 07 "TV" 00 01 02 "Class 465" 00 "Class 465 Description" 00
    2 * 04    01 00 01 08 --EMU sprites
    3 sprites/465s.pcx 66 8 01 18 8 -3 -10
    4 sprites/465s.pcx 82 8 09 16 20 -14 -7
    5 sprites/465s.pcx 114 8 01 12 28 -14 -6
    6 sprites/465s.pcx 162 8 09 16 20 -4 -8
    7 sprites/465s.pcx 194 8 01 18 8 -3 -10
    8 sprites/465s.pcx 210 8 09 16 20 -14 -7
    9 sprites/465s.pcx 242 8 01 12 28 -14 -6
   10 sprites/465s.pcx 290 8 09 16 20 -4 -8
   16 * 9    02 00 A0 01 01 \w0 \w0 -- train sprite

   11 * 04    01 00 01 04 --carriage sprites
   12 sprites/465s.pcx 322 8 01 18 8 -3 -10
   13 sprites/465s.pcx 338 8 09 16 20 -14 -7
   14 sprites/465s.pcx 370 8 01 12 28 -14 -6
   15 sprites/465s.pcx 418 8 09 16 20 -4 -8


   17 * 9    02 00 B0 01 01 \w0 \w0

   18 * 9    03 00 01 0C 00 A0 00 -- add new GFX to Dash DMU
   19 * 7    03 00 81 1B 00 B0 00 --livery override of carriages attached to the train

   20 * 16   00 00 05 01 0C 15 00 14 AE 09 48 00 22 40 19 28
   21 * 7    00 00 01 01 0C 12 FD
   -1 * 0    00 00 01 01 1B 12 FD
Member of the
ImageImage
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Creating matching carriages with Action 3 - NFO Coding

Post by Yexo »

planetmaker wrote:
javaguy wrote: Am I doing something wrong with NFORenum? I was rather hoping for a text file listing some errors or at least a little text doc explaining how to use it. A poke about the thread didn't seem to yield any sort of instruction document either.
Obviously you fail to find the built-in documentation as the documentation which comes along with renum:
I think he failed to start a command line and just double-clicked a prebuild executable.

javaguy: open a command prompt window first (start->run->"cmd"), navigate to the directory with your nfo in it and run "nforenum -h" to see how to use it.
javaguy
Engineer
Engineer
Posts: 76
Joined: 29 Mar 2006 13:08

Re: Creating matching carriages with Action 3 - NFO Coding

Post by javaguy »

:o Well, I did say it was likely that my relative inexperience with command line programs would be the issue! I am using a prebuilt exe but was running it via cmd since every other program takes the grf/nfo/whatever as a command line argument. Had no idea the -h switch existed, as simply typing renum didn't bring up a list of the arguments, which is how I generally work out what to do. Feel a bit stupid now! How I missed the folder called "doc" I have no idea. I assume I thought it was docs for a different program :|

Thanks for the help, anyway. I'll try using the renum tool first, then if all else fails will try using DJ Nekkid's nfo. I appreciate you posting it, of course, but, well, its easier to learn through solving problems like these :p

Edit! It works now :D. NFORenum didn't flag anything in particular up but I recompiled the grf anyway, having edited it to match DJ nekkid's more closely. It still didn't work but I then realised that since early last night I'd been testing the grf by loading a game created when there were no grfs loaded. I created a new game and, surprise surprise, it worked. I do make the stupidest mistakes sometimes :(
I like TTDX :)
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 26 guests