2 # ======================================================================
3 # ======================================================================
8 # ======================================================================
10 # ======================================================================
19 # ======================================================================
21 # ======================================================================
25 die "\nTool used to scan through conversation scripts and verify that all .stf files have the appropriate tags\n\n".
27 "\t\t$name <script file>\n\n";
32 #p4 fstat //depot/swg/current/data/.../string/en/bartender.stf
33 #echo c:\work\swg\current\data\sku.0\sys.server\built\game\string\en\bartender.stf > a.rsp
34 #WordCountTool.exe -d a.rsp
42 open(P4
, "p4 fstat //depot/swg/current/data/.../string/en/${path}.stf | ") or die "Cannot open file: $path\n";
45 push @files, $1 if(/^\.\.\. clientFile (.+)$/);
49 foreach my $elem (@files)
54 system("echo $elem > $tmprsp");
55 open(WORDCOUNT
, "WordCountTool.exe -d $tmprsp | ");
58 $filetags{"\"$1\""} = 0 if(/^\t(\S+)\t/);
62 my $ref = $str_to_tags{$file};
65 foreach my $tag (sort keys %$ref)
67 if(!exists $filetags{$tag})
69 print "\t\tis missing $tag\n";
74 $missing ?
print "\n" : print "\t\tNone missing\n\n";
80 # ======================================================================
82 # ======================================================================
84 &usage
() if(@ARGV != 1);
86 my $scriptfile = shift;
88 print "Scanning script file...\n";
90 open(SCRIPT
, "<$scriptfile");
94 $str_to_files{$2} = $3 if(/(const)?\s+string\s+([A-Za-z_]+)\s+=\s+"([A-Za-z_\.]+)"/);
95 #if(/(new)?\s+string_id\s*\(\s*([A-Za-z_]+)\s*,\s*"([A-Za-z_]+)"\s*\)/)
96 if(/(new)?\s+string_id\s*\(\s*([A-Za-z_]+)\s*,\s*(.+)\s*\)/)
101 $str_to_tags{$str_to_files{$string}} = {} if(!exists $str_to_tags{$str_to_files{$string}});
103 if($tagline =~ s/"(.+)"\s*\+\s*rand\s*\(\s*(\d)+\s*,\s*(\d)+\s*\)//)
111 $str_to_tags{$str_to_files{$string}}->{"\"${tagline}$num\""} = 0;
119 $str_to_tags{$str_to_files{$string}}->{$tagline} = 0;
126 foreach my $str (sort keys %str_to_tags)
128 my $hash_ref = $str_to_tags{$str};
129 print "\nFile: '$str' needs to contain\n";
130 foreach my $tag (sort keys %$hash_ref)
136 print "\nScanning for missing elements of script files...\n";
138 foreach my $filename (sort keys %str_to_tags)