PDA

View Full Version : Checking descr_model_battle.txt



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;

Aradan
11-26-2008, 13:31
How about one for descr_strat, that will check for the consistency of character names?

Any chance you can pack this into an .exe that will do things automatically? (the user will only have to selectthe path to his modfolder)

Squid
11-26-2008, 16:13
Aradan, over at twcenter there's a name checker that does check character names in descr_strat, it was made for M2TW but works perfectly well on RTW.

Aradan
11-27-2008, 15:34
I knew there was a name verifier, but last time I checked it didn't parse DS at all. Different tool maybe.

Thanks for the tip, will go find it.

Well, you can expect me to know every file on TWC, it's not like I'm an admin there or sth...~:rolleyes:

K, here's another one. How about a tool that will check for the existence of proper text descriptions and UI cards for the buildings defined in EDB?

Squid
11-27-2008, 21:41
That unfortunately doesn't exist as of yet, who knows once I get around to finishing the new version of my trait/ancillary validator. I may decide to tackle a new project.

EDIT: http://www.twcenter.net/forums/showthread.php?t=85734 is the tool I was referring to. It's been reported that mod foldered descr_strat files aren't parsed properly, but as I have no acecss to the code I can't say for sure.