I’m trying to rebuild the area table in module.ifo.
Everything works except the line
add /Mod_Area_list/Area_Name, type => gffResref, value => $area;
This builds the table entry correctly, except that the value appears to be blank. This is strange, because printing $area before and after that line demonstrates that it contains the correct string value. Am I missing a trick?
The full script is
# Ensures that the area list in module.ifo matches the area files in the module.
# The list is corrupted if an area is deleted from the Export window or temp0.
%mod = 'C:\Users\MyUser\Documents\Neverwinter Nights\modules\Test.mod' or die;
#
# Build area list in a table
#
@area_list = ();
$area_count = 0;
#
for (%mod['*.git'])
{
$area = substr($_, 0, -4);
print "Area In=", $area, "\n";
$area_list[++$area_count] = $area;
}
#
# Copy table to module
#
for (%mod['module.ifo'])
{
delete /Mod_Area_list;
#
for (@area_list)
{
$area = $_;
print "Area Found=", $area, "\n";
add /Mod_Area_list, type => gffList unless /Mod_Area_list;
add /Mod_Area_list/Area_Name, type => gffResref, value => $area;
print "Area Out=", $area, "\n";
}
}
%mod = '>' or die;
close(%mod) or die;