View Single Post
  #33  
Old 03-01-2010, 04:30 PM
ptarp
Fire Beetle
 
Join Date: Jan 2010
Location: Idaho
Posts: 27
Default

I tinkered with import_spells.pl a bit.
As a test, I created a new table copy of "spells_new" table. Named it "Spells_live" and emptied it., then changed import_spells.pl with this
Code:
--- C:/test/import_spells.old.pl	Mon Mar  1 13:13:41 2010
+++ C:/test/import_spells.pl	Mon Mar  1 13:14:52 2010
@@ -9,7 +9,7 @@
 getopts('c:s:t:dh');
 my $conf = "eqemu_config.xml"; #default
 my $spellf = "spells_us.txt"; #default
-my $table = "spells_new"; #default
+my $table = "spells_live"; #default
 
 if ($opt_h) { #help (-h)
 	printf "\nUsage: import_spells.pl [-c path] [-s path] [-t table] [-d]\n";
@@ -102,6 +102,7 @@
 		}
 	} elsif (scalar(@s) > scalar(@t_col_names)) {
 		for (my $z = 1; $z <= $col_diff; $z++) {
+		  if ( length(@s) < 1 ) { @s = 0 }
 			pop(@s);
 		}
 	}
The added single line converts any null value to 0 before the string is populated.
Tested with a copy of the Spells_en.txt and spells_us.txt from my live EQ folder, and got a result of "Spells loaded: 23120 of 23120"
The resulting table 'looks' correct also, though I haven't gotten around to testing anything with it. Not sure how "correct" the code is either, since I've never really looked at perl before. Should work fine with SoF files.
Reply With Quote