Pazyryk
Deity
- Joined
- Jun 13, 2008
- Messages
- 3,584
EDIT: This is a bit obsolete now...
Download from the files database here: http://forums.civfanatics.com/downloads.php?do=file&id=17823
If you have a lot of art (say >10 large dds files) then Modbuddy gets really slow. This tool can add 200 .dds files (~0.5 M each) in 4 seconds, probably only limited by my system's ability to read/copy files. (OK, 31 seconds when I have ModBuddy, Civ5 and the Tuner running at the same time...) It should work for any other file extension too.
You specify (in User Settings at the top of the script):
The script will:
The script detects and skips files already in your mod (based entirely on .modinfo "<Files>" section), so you can call it repeatedly without harm (note: calling twice in succession actually has a nice side effect of forcing a mod browser update, so I always do that). So, the way I use this is that I generate and keep .dds files in the same folder as original .jpeg's (in my own Art folder far from Civ5 mod stuff). Whenever I make a new .dds (or build a new mod version from ModBuddy), I just run the script again and it only adds the files not already in the latest mod version. I add no art in ModBuddy at all (though it won't hurt if you do).
More details in header information in the script (pasted below). My apologies to all, it is written in PERL (which I use for work), but I have included instruction for obtaining PERL free and getting the needed modules.
I haven't learned how to make ModBuddy extensions yet. If someone includes detailed instructions below, I'll add it to this post.
No, I won't be translating this to Lua or some other language. But feel free to do so yourself.
- ModBuddy seems faster to me now.
- If you have 100s of large art files (like me) what you should do is this: Split your mod into two mods, one called "MyMod Media Pack" containing all of your many art files. Make your main mod require the Media Pack in dependencies (which work now). If you do all your difficult Lua/SQL/XML code in the non-media mod, then you will rarely need to build the larger Media Pack.
Download from the files database here: http://forums.civfanatics.com/downloads.php?do=file&id=17823
If you have a lot of art (say >10 large dds files) then Modbuddy gets really slow. This tool can add 200 .dds files (~0.5 M each) in 4 seconds, probably only limited by my system's ability to read/copy files. (OK, 31 seconds when I have ModBuddy, Civ5 and the Tuner running at the same time...) It should work for any other file extension too.
You specify (in User Settings at the top of the script):
- your mod name (without version number)
- path to MODS folder
- and then in sets of three:* source folder for your files (anywhere on your computer)
* destination folder in mod
* file extension
The script will:
- find the "current" mod (the one with the highest version number)
- read your files (only those with specified file extension in specified folders)
- generate md5s
- add to .modinfo right after the <Files> tag with import="1"
- copy files to specified mod folders, creating folders/paths as needed
The script detects and skips files already in your mod (based entirely on .modinfo "<Files>" section), so you can call it repeatedly without harm (note: calling twice in succession actually has a nice side effect of forcing a mod browser update, so I always do that). So, the way I use this is that I generate and keep .dds files in the same folder as original .jpeg's (in my own Art folder far from Civ5 mod stuff). Whenever I make a new .dds (or build a new mod version from ModBuddy), I just run the script again and it only adds the files not already in the latest mod version. I add no art in ModBuddy at all (though it won't hurt if you do).
More details in header information in the script (pasted below). My apologies to all, it is written in PERL (which I use for work), but I have included instruction for obtaining PERL free and getting the needed modules.
Code:
#!/usr/bin/perl
use File::Path;
use File::Glob ':glob';
use File::Copy::Vigilant;
use Digest::MD5;
########## By Pazyryk. Use, alter and distribute as you please. ################
#
# Gets all files in specified folders (of specified extension) and copies into
# the "current" mod (the one with the largest version number) in the specified
# folders (creating folders and paths if necessary), without creating redundant
# items. It will add them to the .modinfo file with the correct md5 and
# "include=1". You can create as many source->destination folder sets as you
# need, each with its own specified file extension (User Settings below).
#
# WARNING! Script overwrites .modinfo file. Use at your own risk.
#
# Notes:
# * When specifying source folders, files of non-specified extension are
# ignored. (E.g., I keep .dds's in the same folder as original .jpeg's.)
# * If a file name already exists in .modinfo (between <File> and </File>)
# then this script will skip that file, regardless of folder or import=1 or
# =0. So you can call this script repetitively (e.g., by mistake or after
# creating a new .dds file) without creating redundant items in your mod.
# * The script uses the .modinfo file (and only that) to check for already
# existing files. It will overwrite a file of the same name in the specified
# destination folder if it isn't in .modinfo.
#
# Installing PERL and required moduals
# * Free PERL download: http://www.activestate.com/activeperl/downloads.
# * If your PERL build is like mine, then you will need to install two
# moduals: Digest-MD5 and File-Copy-Vigilant. You can type "ppm" in any
# command window to get the Perl Package Manager. If not installed, click
# View->All Packages, then right-click->install on the needed modual. No,
# you're not done yet. Look for the obscure green arrow (->) in the top
# panel (mouse-over says "run marked actions") and press it.
#################### User Settings #######################################
$mod = ""; # e.g., "MyMod", not "MyMod (v 1)"
$mods_folder_path = ""; # Path to MODS folder; see examples below
$art_from[0] = ""; # Path to source files
$art_to[0] = ""; # Path relative to mod folder
$extension[0] = "dds"; # File type to copy/add (note: I've only tested dds)
# Repeat last three lines with [1,2,...] as needed,
# but they must be added in sets of three
# Notes:
# $mod must be without version!
# Example $mods_folder_path:
# "C:/Users/Me/Documents/My Games/Sid Meier's Civilization 5/MODS"
# (Note that spaces and ' are handled OK. Not sure about other weird chars.)
# Example art_from, art_to, extension triplet:
# $art_from[0] = "C:/Users/Me/Desktop/MyArt/People";
# $art_to[0] = "Art/HiRes2D/People";
# $extension[0] = "dds";
# Add more triplets as needed with index 1, 2, etc.
#
# Paths can be relative if you like, so "" works as current dir (except
# $art_to[#] is always relative to mod folder).
# WARNINGS!
# * The actual mod folder name must be of standard format "MyMod (v 21)" with
# the same exact two spaces (the number can be any integer > 0).
# * You should not have anything resembling " (v #)" in any of the User
# Settings specified above!
################################################################################
I haven't learned how to make ModBuddy extensions yet. If someone includes detailed instructions below, I'll add it to this post.
No, I won't be translating this to Lua or some other language. But feel free to do so yourself.