Here is a nifty something that I threw together in Perl, that you can use to extract all the npcs, and the images they use, to files.
Note: I know this works in Windows, can’t speak for other OS’s
To use this tool :
-
go to www.activestate.com and install ActivePerl on your computer. Its free.
-
copy this code
[php]
use File::Find;
use Cwd;
$path=getcwd();
$folder="/world";
$path=$path.$folder;
%img=();
find(\&x,$path);
open(OUT,">all_npc_images_used.txt");
foreach my $key (sort {$a cmp $b} keys %img)
{
print OUT "$key
";
}
close(OUT);
############################
sub x
{
#check each .nw file for npcs, and if we find one, export it to its own file
return if -d;
return unless m/\.nw$/;
$nwfile=$File::Find::name;
$nwfile=~s/$path\///;
$nwfile=~s/\.nw//;
$counter=0;
print “$nwfile
“;
open(FILE,”<$File::Find::name”);
$isnpc=0;
until (eof(FILE))
{
$line=;
chop($line);
if ($isnpc==1)
{
$npcstring=$npcstring.$line."\
";
}
if($line =~ /^NPC (.*?) /)
{
$img{$1}=1;
$isnpc=1;
#create filename
$npcfile=$nwfile;
$npcstring=""; #append to this while $isnpc is 1
}
if($line =~ /^NPCEND/)
{
$counter++;
# write npc to file
$isnpc=0;
$outfile=$path."\\/$npcfile\\_npc".$counter."\\.txt";
$outfile=~s/ /\\_/g;
$outfile=~s/world/perl_npcs/g;
open(OUT,">>$outfile");
$npcstring=~s/NPCEND//;
#print $npcstring;
print OUT "$npcstring\
";
close(OUT);
unless (-e $outfile)
{
die "Unable to create $outfile!
";
}
}
}
close(FILE);
}
[/php]
-
In your graal reborn server folder, go to the servers/default/ directory and create a new text file. Open the file and paste in the code. Save the file.
-
rename the file to find_npcs.pl or something with the .pl extension. The icon for the file should change (indicating successfull file association with ActivePerl)
-
create a new folder here in the servers/default directory called perl_npcs
-
double click the find_npcs.pl file
then look in the perl_npcs folder and there you go! the all_npc_images_used.txt will appear in the servers/default directory.
Please feel free to provide any constructive feedback and enhancements. I plan to make more of these for finding all levels linked to (then make sure no levels are missing), presence of chests and what type (for example, determine how many full hearts, sword and shield levels, total rupees etc exist within your world) and other stuff