iamphet
11-26-2008, 12:35
Hi, below is a simple Perl script to check your descr_model_battle.txt for consistency
Can you suggest what other files are worth such a check?
#
# dmbcheck.pl
#
# an ad-hoc Perl script to check for references to missing files in descr_model_battle.txt
# run it from your RTW folder with something like "perl dmbcheck.pl > ok.txt 2>errors.txt"
# and examine files ok.txt and errors.txt
# set it to your mod dir if the mod uses -mod switch or set it to "" otherwise
# using EB by default
$mod = "eb/";
open F, "<${mod}data/descr_model_battle.txt";
while (<F>)
{
if (/^model_sprite\s+[^,]+,[^,]+,\s*(.*?)\s*$/ or
/^model_sprite\s+[^,]+,\s*(.*?)\s*$/)
{
if (-f $1)
{
print "sprite $1 exists\n";
}
else
{
print STDERR "sprite $1 does not exist\n";
}
}
elsif (/^texture\s+[^,]+,\s*(.*?)\s*$/)
{
if (-f $1 or -f "$1.dds")
{
print "texture $1 exists\n";
}
else
{
print STDERR "texture $1 does not exist\n";
}
}
elsif (/^model_flexi(?:_m)?\s+(.*?)\s*,/)
{
if (-f $1)
{
print "model $1 exists\n";
}
else
{
print STDERR "model $1 does not exist\n";
}
}
# consistency check
elsif (/^model_sprite/ or /^model_flexi/ or /^texture/)
{
print STDERR "entry '$_' has not been parsed for some reason, please check\n";
}
}
close F;
Can you suggest what other files are worth such a check?
#
# dmbcheck.pl
#
# an ad-hoc Perl script to check for references to missing files in descr_model_battle.txt
# run it from your RTW folder with something like "perl dmbcheck.pl > ok.txt 2>errors.txt"
# and examine files ok.txt and errors.txt
# set it to your mod dir if the mod uses -mod switch or set it to "" otherwise
# using EB by default
$mod = "eb/";
open F, "<${mod}data/descr_model_battle.txt";
while (<F>)
{
if (/^model_sprite\s+[^,]+,[^,]+,\s*(.*?)\s*$/ or
/^model_sprite\s+[^,]+,\s*(.*?)\s*$/)
{
if (-f $1)
{
print "sprite $1 exists\n";
}
else
{
print STDERR "sprite $1 does not exist\n";
}
}
elsif (/^texture\s+[^,]+,\s*(.*?)\s*$/)
{
if (-f $1 or -f "$1.dds")
{
print "texture $1 exists\n";
}
else
{
print STDERR "texture $1 does not exist\n";
}
}
elsif (/^model_flexi(?:_m)?\s+(.*?)\s*,/)
{
if (-f $1)
{
print "model $1 exists\n";
}
else
{
print STDERR "model $1 does not exist\n";
}
}
# consistency check
elsif (/^model_sprite/ or /^model_flexi/ or /^texture/)
{
print STDERR "entry '$_' has not been parsed for some reason, please check\n";
}
}
close F;