Here, you'll find some Perl scripts I wrote for Planets - some for personal needs, some on requests from the newsgroups. Have fun with them.
parseaux.pl - Parse AUXDATA file to stdout | |
parsekore.pl - Parse KOREx.DAT file to stdout | |
parseuti.pl - UTILx.DAT parser | |
plcat.pl - Display contents of a XYPLAN.DAT file | |
plrand.pl - Planet location randomizer | |
regchk.pl - Simple registration checker | |
shiplist.pl - Ship List Image Overview | |
Go to my VGA Planets Page |
Parse AUXDATA file to stdout.
Usage: perl parseaux.pl game/dir/auxdata.hst
Initial version hacked together in June 2001; upgraded to PHost 4.x file format in May 2003.
This works similar in spirit to the util.dat parser: to add a new record, add a `parseXX' function. This isn't the most nice piece of code there is, but it seems to work quite well.
Parse KOREx.DAT file to stdout
Usage: parsekore.pl KOREx.DAT
The KOREx.DAT file contains: mine fields, ion storms, explosions, Ufos, and additional visual contacts. In particular, it has "true" minefield data for your race: if one of your minefields is not in koreX.dat, it is gone.
UTILx.DAT parser. Written from documentation, not PHost source.
Usage: perl parseutil.pl [-d|-u|--help] [-M] [-fNN] utilx.dat [filename.txt] perl parseutil.pl [-d|-u|--help] [-M] [-fNN] -m utilx.dat...
2001,2002,2003,2004,2005,2006 by Stefan Reuther <Streu@gmx.de>. Public Domain.
To add a new record type, just add a `decodeNN' function, where NN is the decimal record number. These functions are called with global variable $data = binary image of record. Note that the `decodeNN' functions must return non-zero, which happens implicitly if they end with `print'. Similarily, use `unpackNN' for unpacking files.
Note 29/Dec/2003: I've changed most decoders to use the `print_unpack' function, for more consistency and reliability. For those which I did not yet test on live data I let the original code in a comment.
Display contents of a XYPLAN.DAT file
Usage: perl plcat.pl gamedir\xyplan.dat
This will output all X,Ys of all planets. You can then use a program like GNUPLOT to plot these, or import it into a spreadsheet.
Planet location randomizer. Shuffles around the planet locations in xyplan.dat. Does NOT shuffle around pdata.hst entries, so use this *before* mastering.
Usage: perl plrand.pl gamedir\xyplan.dat
Simple registration checker.
Usage: perl regchk.pl game1\*.trn game2\*.trn ...
This checks for duplicate registrations. When two of the TRNs specified on the command line contain the same registration, this will tell you. This does not actually decrypt the keys.
Ship List Image Overview
Usage: perl shiplist.pl <directory>
This generates a HTML file on stdout, which contains all ship types, as well as their pictures. Place the file in your Winplan directory, and open it with your browser, to see all ships. This is useful for ship-list designers, to see what pictures are available.