tes3cmd is a little multi-tool program for examining and changing plugins.
Wiki page with download instructions here: http://code.google.com/p/mlox/wiki/Tes3cmd
(Requires Perl)
Features:
* dump records from a plugin in readable format.
* find records that are common between 2 plugins.
* batch rename of records (NAME/FNAM values).
* find overlapping dialog between plugins which are a possible source of quest bugs.
* delete records/sub-records.
* find differences between two plugins.
* create a patch for fogbugged CELLs.
* modify the Author/Description fields of the TES3.HEDR record.
While tes3cmd is mostly for the "power user", at least the fogpatch feature is likely to appeal to anyone who suffers from the "fogbug" that turns some internal CELLs black. With one simple command line (described below), tes3cmd will generate a patch to fix all those cells.
Usage
Note that the following usage definitions and examples presume you are prefixing tes3cmd with "perl". You can also write a batch file "wrapper" to encapsulate the command-line, or even make a "shortcut" so you can redo common tasks by dragging and dropping plugins onto it. This is all discussed on the InstallPerl page, and is recommended reading if you are unfamiliar with Perl scripts and command line usage.
Dump Records
Usage: tes3cmd dump OPTIONS plugin...
OPTIONS
-D turn on debug output.
-i ids only print out the records with ids matching the given comma-delimited
list of regular expression patterns.
-l only list the ids of the records to be printed, instead of the entire record.
-m regex only print records that match given regular expression.
-r print raw records, instead of as text.
-s string specify field separator string for single-line output.
-t types only print out the records matching the given comma-delimited
list of record types.
Dumps the plugin to stdout in text form for easy perusal. For large plugins,
the output can be voluminous.
Note: tes3cmd uses Perl regular expressions for matching, the full documentation
can be found here: http://www.perl.com/doc/manual/html/pod/perlre.html
You should at least be aware that the characters "\.?*+|^$()[]{}" have special
meaning in a regular expression and that they are unlike characters used for
matching on a Windows command line.
Examples:
# Dump all records from a plugin (this could generate a lot of output):
tes3cmd dump plugin.esp
# Dump all records with IDs matching "foo":
tes3cmd dump -i foo plugin.esp
# Dump all the CELL records from a plugin:
tes3cmd dump -t cell plugin.esp
# Dump all cells from bradhia_v1_4.esp containing NPC named: "Maeve Jaste"
tes3cmd dump -t cell -m "NAME:.*maeve.jaste" bradhia_v1_4.esp
List Records Common Between Two Plugins
Usage: tes3cmd common OPTIONS plugin1 plugin2
OPTIONS
-D turn on debug output
Prints the IDs of records that the 2 given plugins have in common.
Example:
# Show the records in common between my plugin and Morrowind.esm:
tes3cmd common myplugin.esp Morrowind.esm
Batch Rename Records
Usage: tes3cmd rename OPTIONS RECTYPE.SUBTYPE FROM TO plugin...
This first form of the command renames all records of type RECTYPE, replacing
the Perl regular expression FROM with the value of TO (which may contain
backreferences). The rename only happens if the CELL.NAME subrecord matches
the given FROM regular expression.
Note: tes3cmd uses Perl regular expressions for matching, the full documentation
can be found here: http://www.perl.com/doc/manual/html/pod/perlre.html
You should at least be aware that the characters "\.?*+|^$()[]{}" have special
meaning in a regular expression and that they are unlike characters used for
matching on a Windows command line.
tes3cmd rename -l RECTYPE.SUBTYPE plugin...
When the -l switch is given, records of the given type are only listed. (You
do not give a FROM or TO when using the -l option).
OPTIONS
-D turn on debug output
-i only rename if the record is an interior CELL.
-e only rename if the record is an exterior CELL.
-l just list the records, do not rename them. (This is obsolete, use the "tes3cmd dump" command instead)
-w size of printable window for record contents printed with -l switch.
The original input file is never modified, the changes are made in a new file
"
Note that when renaming scripts, you can use either SCPT.SCTX or SCPT.SCHD as
the RECTYPE.SUBTYPE parameter, and the script name is changed in both
subrecords.
Examples:
# rename all exterior cells to the null string:
tes3cmd rename -e CELL.NAME ".*" "" plugin.esp
# do a caseless comparison with the FROM pattern:
tes3cmd rename cell.name "(?i)pelagaid" "Pelagiad" plugin.esp
(This would rename any name that has the string "pelagaid" in it with any form
of capitalization, to "Pelagiad").
# The following command will swap the first and last name of all NPCs using
# substitution backreferences (a very powerful feature of regular expressions):
tes3cmd rename npc_.fnam "^(\S+)\s(\S+)$" "$2 $1" plugin.esp
(Note that on Linux you may need to use single-quotes instead of double-quotes).
Find Overlapping Dialog
Usage: tes3cmd overdial OPTIONS plugin...
OPTIONS
-D turn on debug output
-1 only test to see if dialog in the first plugin is overlapped. (by default
all plugins are checked against all other plugins, which is an n-squared
operation, meaning "possibly very slow").
Prints the IDs of dialog records that overlap from the set of given plugins.
An overlap is defined as a dialog (DIAL) Topic from one plugin that entirely
contains a dialog Topic from another plugin as a substring. For example, the
mod "White Wolf of Lokken" has a dialog topic "to rescue me" which overlaps
with the dialog topic "rescue me" from "Suran Underworld", which causes the
"Special Guest" quest from SU to get stuck because Ylarra won't offer the
topic "rescue me" when you find her in her cell.
Note that overlap is only a potential problem if the plugins are loaded in the
order they are listed in the output.
Example:
# Show dialog overlaps between Lokken and SU:
tes3cmd overdial BT_Whitewolf_2_0.esm Suran_Underworld_2.5.esp
Delete Records
Usage: tes3cmd delete OPTIONS plugin...
OPTIONS
-D turn on debug output
-i ids only delete the records with ids matching the given comma-delimited
list of regular expression patterns.
-m regex only delete records that match given regular expression.
-s only delete the subrecords that matched.
-t types only delete the records matching the given comma-delimited
list of record types.
Deletes records/subrecords from the plugin. You can really damage things with
this command, so be careful!
Note: tes3cmd uses Perl regular expressions for matching, the full documentation
can be found here: http://www.perl.com/doc/manual/html/pod/perlre.html
You should at least be aware that the characters "\.?*+|^$()[]{}" have special
meaning in a regular expression and that they are unlike characters used for
matching on a Windows command line.
Examples:
# Delete all records with IDs matching "foo":
tes3cmd delete -i foo plugin.esp
# Delete all subrecords of type npc_.npc0 that match "Ring des Skeletts" from
# savegame: quicksave.ess
tes3cmd delete -s npc_.npc0 -m "Ring des Skeletts" quicksave.ess
Find Differences Between Two Plugins
Usage: tes3cmd diff OPTIONS plugin1 plugin2
OPTIONS
-D turn on debug output.
-i comma-delimited list of field names to ignore.
Prints a report on the differences between the two TES3 files.
A summary report with up to four sections is printed to standard output
that gives an overview of differences, as lists of record IDs:
- objects in plugin1 that do not exist in plugin2
- objects in plugin2 that do not exist in plugin1
- objects in plugin1 that are equal in plugin2
- objects in plugin1 that are different in plugin2
(Sections that would have no items are not printed).
When objects in plugin1 are different in plugin2, each of these objects
is printed in detail to a file "plugin1.diff" and "plugin2.diff", which
can then be compared textually using a tool such as WinMerge or Emacs'
ediff function.
To reduce a great deal of "uninteresting" differences when diffing savegames,
CELL.FRMR records are automatically ignored when the ModIndex is zero. (Note
that in this case, the ObjIndex appears to only be incremented by one).
Example:
# Print report on differences between 2 savegames:
tes3cmd diff save1000.ess save2000.ess > diff.out
# You can also use the -i switch to ignore further subfields in order to help
# reduce the amount of differences as in the following example.
# Report on differences, but ignore the subfields CREA.AIDT and CELL.ND3D:
tes3cmd diff -i crea.aidt,cell.nd3d testa0000.ess testb0000.ess > diff.out
Patch Fogbugged CELLs
Usage: tes3cmd fogpatch
OPTIONS
-D turn on debug output
Creates a patch plugin to fix all cells in your plugins that would trigger the fogbug.
Examples:
# Create the patch plugin fogpatch.esp
tes3cmd fogpatch
Display/Update the TES3 Header
Usage: tes3cmd header OPTIONS plugin...
OPTIONS
-D turn on debug output
-a XXX set the Author field to the value XXX
-d YYY set the Description field to value YYY
-m multi-line output for listing field contents.
When -a and -d are not given, the current Author/Description field contents
are printed.
Field values are normally replaced by the given string. But if the string
begins with a "+", the existing value is appended with the new given value.
If a given value contains the string "\n", it will be replaced by a CRLF.
Note:
- the Author value should fit in 31 bytes.
- the Description value should fit in 255 bytes.
If the value supplied won't fit into the plugin header field, you will be
warned.
Examples:
# Show the Author/Description fields for a plugin:
tes3cmd header plugin.esp
# Set the Author field to "john.moonsugar":
tes3cmd header -a john.moonsugar plugin.esp
# Append " and friends" to the Author field:
tes3cmd header -a "+ and friends" plugin.esp
# Add a Version number to a plugin Description field:
tes3cmd header -d "+\nVersion: 1.0" plugin.esp