Here are some examples how you can use the tools:
First you need to unpack erf or module to separate files, this can be
done using erfunpack.pl:
$ ./erfunpack.pl --mkdir --dir cerea101t cerea101t.mod
This will create directory called cerea101t and unpack all separate
files there.
The best way to start using the gffprint.pl is to simply say:
$ ./gffprint.pl --dialog ../nwn-server/dialog.tlk cereaadminbuildi.gitg | less
which will then print out the whole file. The --dialog option can be
used to give the dialog.tlk file name, so it can be used to convert
string refs to the actual texts. If it is not given then those texts
are printed only as string ref numbers.
$ ./gffmatch.pl *.git --include Creature --find-struct '^/Creature List\[\d+\]/$' --find '/Plot:=:^1$' --print-fields '/Creature List\[\d+\]/Tag$'
The output will be:
adampcave.git: /Creature List[0]/Tag: MineManager admhelperarea.git: /Creature List[0]/Tag: postneutral admhelperarea.git: /Creature List[1]/Tag: postcommoner admhelperarea.git: /Creature List[2]/Tag: postmerchant admhelperarea.git: /Creature List[3]/Tag: postdefender admhelperarea.git: /Creature List[4]/Tag: postbard ...
Here the --find-struct matches the structure we want to check for values, remember to put ^ and $ in the regexp to make sure we only match to the specific structure instead all childs of the structure.
The --find options can list matches which must be fullfilled. The format is regexp:=:regexp, where the first regexp matches the full field name, and second to the value.
The --print-fields is a regexp matching to the field names inside the structure matched. Those are printed from the structure matched if all the --find options matched too. It cannot print anything outside the matched structure (--find-struct).
The --include makes the process go faster, as it will skip parsing all other structures unless they have string Creature in them, i.e. it only parses the '/Creature List' array, and skips '/Door List', '/Placeable List' etc from the areas.
Remember that the --find-structure must match only those you really want, i.e. put it in form '^/Creature List\[\d\]/$'. Also remember that [ and ] have special meaning in the regexp, so you need to add \ in front of them when matching the array index (use \d+ to match any index in array). Remember that structure paths end to / so put that in the end before $.
When writing the --find regexp, remember that the label-regexp is the full label, including the struct path, i.e. use '/foo$' there without the ^ in the beginning, but do add $ to the end. Also when mathing the value use ^ in the beginning and $ in the end.
$ ./gffcmp --exclude-field TemplateResRef adamantitetwi002.uti adamantitetwinbl.uti
will not print anything out as those two items are identical with all
other cases than with the TemplateResRef. If you call it as gffdiff or
give --diff option then it will print out all differences instead of
just one.
Without the --exclude-field option it will print out following output:
$ ./gffcmp.pl adamantitetwi002.uti adamantitetwinbl.uti File adamantitetwinbl.uti do not match to base file : Values of /TemplateResRef differ, adamantitetwi002 vs adamantitetwinbl
The following code will extract all scripts mentioned in the key
files. Note, that you must be in the toplevel nwn directory, as
othewise the keyunpack does not know how to find the bif files.
$ ./keyunpack.pl -d default-scripts -m -p '.*\.n[cs]s$' *.key
Note, that this will read the key files in the order they are given in
the command line, and if later version of the key file have other
version of the script it will overwrite the old one. As the default
nwn have 5 key files and giving them in alphabetical order happens to
give them in right order (I guess chitin.key, xp1.key, xp1patch.key,
xp2.key and xp2patch.key is the correct order), this will work.
$ ./erfpack.pl --dir cerea101t -m -o newcerea101t.mod
will take everything from directory called cerea101t and creates a new
module called newcerea101t.mod having all the stuff that was inside
that directory.