- It now updates the masters of the plugin after cleaning it so that you don't get Yellow and/or Orange boxes in Wrye Mash telling you the masters don't match. If you don't use Wrye Mash (OMG!! Why not!!?), then this will prevent you from getting the, "One or more plugins could not find the correct versions of the master files they depend on..." error when loading Morrowind.
- It now copies backups of the 'dirty' plugins and the -cleaned.log files into the \Data Files\tes3cmd\backups folder by default, but you can modify the paths to your own preference. Couldn't get the --backup-dir option working; so this is a compromise, but it actually gives you a bit more flexibility with both the backups and logs. :shrug:
@ECHO off:STARTCLSREM *******************************************************************************REM * "Drag-and-Droppable" batch file...REM *REM * 1. Copy TES3CMD.exe to \Morrowind\Data Files directoryREM * 2. Create a batch file with this code in the \Morrowind\Data Files directoryREM * 3. OPTIONAL -- Create a SHORTCUT to this batch file on your desktopREM * 4. Drag ESP/M files onto the desktop shortcut or the actual batch fileREM *REM * The new 'clean' plugin will take the place of the old 'dirty' plugin. The oldREM * 'dirty' plugin will be backed up to \Date Files\tes3cmd\backups. A log fileREM * called '-cleaned.log' will be created in \backups as well.REM *REM * Tribunal.esm and Bloodmoon.esm will use a different cleaning method so as notREM * to Remove required GMSTs.REM *******************************************************************************REM *******************************************************************************REM * Always clean in this order...REM *REM * 1. Official Masters (Tribunal.esm and Bloodmoon.esm)REM * 2. Mod Masters (e.g. GIANTS.esm, etc.)REM * 3. Mod Plugins relying on Official or Mod MastersREM * 4. Mod Plugins that are a Master to another PluginREM * 5. All other Plugins with or without Master or Plugin Master dependenciesREM *REM * DO NOT CLEAN Plugins that act as "control files" for other Masters ... yet.REM * Still working on that last one... have to ignore duplicates related to theREM * mod Master but still clean the duplicates related to Official Masters...REM * An example of this would be the GIANTS Ultimate Control File ESP.REM *******************************************************************************REM *******************************************************************************REM * Disable default ESP/M and Log output backup directory...REM *REM * The Backup ESP/M and Log Output files directory is now set to the defaultREM * \Data Files\tes3cmd\backups. All original 'dirty' mods will be moved toREM * this location along with the -cleaned.log files. If you want to turn thisREM * feature off and leave the backup and the log files in the originalREM * location...REM *REM * 1. Delete the three (3) instances of '--hide-backups' in each tes3cmd lineREM * 2. Change all four (4) instances of '%LOG%' to '%1'REM * 3. Just ignore the 'Set LOG="%cd%\tes3cmd\backups\%~nx1"' line in this case.REM *******************************************************************************REM *******************************************************************************REM * DO NOT EDIT THIS DEFAULT PATHSET DEF=%cd%\tes3cmd\backups\REM * DO NOT EDIT THIS DEFAULT PATHREM *******************************************************************************REM *******************************************************************************REM * Change default ESP/M backup and log file directories...REM *REM * Replace %DEF% with the path(s) where you wish to use to store your ESP/MREM * backups and/or your -cleaned.log files. Otherwise, leave as-is for default.REM *REM * Example: SET BKP=C:\Games\Bethesda Softworks\MW ESPM Backups\REM * Exmaple: SET LOG=C:\Games\Bethesda Softworks\Log Files\REM *******************************************************************************SET BKP=%DEF%SET LOG=%DEF%REM *******************************************************************************REM * If user-defined path does not exist yet, create it.REM * Append user-defined path statement with the Plugin.name.REM * Append default path statement with the Plugin.name.REM *******************************************************************************IF NOT EXIST %BKP% MD %BKP%IF NOT EXIST %LOG% MD %LOG%SET DEF="%DEF%\%~nx1"SET BKP="%BKP%\%~nx1"SET LOG="%LOG%\%~nx1"REM *******************************************************************************REM * Check for Morrowind.esm, Tribunal.esm, and Bloodmoon.esmREM * If none of these, then "standard" ESP/M cleaning occurs...REM *******************************************************************************IF "%~nx1" == "Morrowind.esm" GOTO MORRIF "%~nx1" == "Tribunal.esm" GOTO NO_GMSTIF "%~nx1" == "Bloodmoon.esm" GOTO NO_GMSTGOTO GMSTREM *******************************************************************************REM * If file is Morrowind.esm ...REM * Cannot clean Morrowind.esm -- There is no master above it to check against!!REM *******************************************************************************:MORRECHO You cannot clean %~nx1! >> %LOG%-cleaned.logECHO ******************************* >> %LOG%-cleaned.logGOTO DISPPAUSEGOTO ENDREM *******************************************************************************REM * If file is Tribunal.esm or Bloodmoon.esm ...REM * Add --debug after "clean" in the line below to enable verbose debugging mode.REM *******************************************************************************:NO_GMSTECHO Detected %~nx1 . . .ECHO GMSTs will NOT be cleaned . . .tes3cmd clean --hide-backups --instances --cell-params --dups --junk-cells --replace %1 > %LOG%-cleaned.log 2>&1ECHO ********** TES3CMD Clean Plugin Process Completed ********** >> %LOG%-cleaned.logGOTO POST REM *******************************************************************************REM * If file is any other plugin or master ...REM * Add --debug after "clean" in the line below to enable verbose debugging mode.REM *******************************************************************************:GMSTECHO Cleaning plugin %~nx1 . . .tes3cmd clean --hide-backups --replace %1 > %LOG%-cleaned.log 2>&1ECHO ********** TES3CMD Clean Plugin Process Completed ********** >> %LOG%-cleaned.logGOTO POSTREM *******************************************************************************REM * Update masters and output results of tes3cmd cleaning to CMD window.REM * Append to -cleaned.log output file.REM *******************************************************************************:POSTECHO Updating masters for %~nx1 . . .ECHO ********** TES3CMD Update Masters Process Started ********** >> %LOG%-cleaned.logECHO ** If no data follows, Masters did not need to be updated ** >> %LOG%-cleaned.logtes3cmd header --hide-backups --update-masters %1 >> %LOG%-cleaned.log 2>&1ECHO ********* TES3CMD Update Masters Process Completed ********* >> %LOG%-cleaned.logREM *******************************************************************************REM * Check to see if user changed default ESP/M backup path, and if so, move fileREM * to the new location. Log files are already created in the user-defined path.REM *******************************************************************************IF NOT %BKP% == %DEF% MOVE %DEF% %BKP%REM *******************************************************************************REM * Check if cleaned plugin is a Master (ESM), then check if tes3cmd has cachedREM * it already. If so, delete master.esm.cache file.REM *******************************************************************************IF NOT "%~x1" == ".esm" GOTO DISPIF NOT EXIST "%cd%\tes3cmd\%~nx1.cache" GOTO DISPDEL "%cd%\tes3cmd\%~nx1.cache"REM *******************************************************************************REM * Outputting results to file via "> %1-cleaned.log 2>&1" as above will not printREM * to screen without explicitly using 'type' command.REM *******************************************************************************:DISPTYPE %LOG%-cleaned.logECHO TES3CMD Clean Plugin and Update Masters processes have completed . . .PAUSEGOTO ENDREM *******************************************************************************REM * End of batch commands, exit CMD window.REM *******************************************************************************:END
Let me know if you have any problems with it. Unless any are reported, I'm going to focus on helping Yakoby play around with integrating features into Wrye Mash 85 Stand Alone, including these kinds of features for tes3cmd, but this should hold you over for now.
Thanks!
-RMWChaos