View Full Version : file list to zone startup?
Rhodan
12-04-2008, 07:49 AM
I want to start every single zone as a static zone but I'm not really into manually entering "zone" and "<mapname>" into the zone startup list.
I can get text file with all the map names with
dir *.map /B > maplist.exe
but I can't think of a simple way to get from there to inserting the names into the startup table. Any ideas?
AndMetal
12-05-2008, 12:58 AM
I think you could do this with a subquery to the zones table (to get the list of zone names), but I'm not sure what it would be, specifically, off the top of my head.
trevius
12-05-2008, 02:10 AM
Try pasting them into excel, or saving them into a .txt file and import the file into excel using a period as the delimiter to strip off the file extension into another row. Then, just delete the rows you don't want and make a row of all zone. Should be easy enough if you have excel.
Rhodan
12-05-2008, 09:44 AM
I ended up making a perl script that creates an sql file.
first I do a "dir maps\*.map > filelist" to get the .map names, then run the perl script which takes the names, drops the .map extention, and stuffs them into an insert statment.
#! /usr/bin/perl
print "Getting map names.";
$in_file="filelist";
$out_file="zonelist.sql";
open(IN,"<$in_file") or die "Can't open $in_file: $!\n";
open(OUT,">$out_file") or die "Can't open $out_file: $!\n";
print OUT "use peq;\n";
while ($line=<IN>) {
$line = substr($line,0,length($line)-5);
print OUT "insert into launcher_zones VALUES ('zone','$line',0);\n";
}
close IN;
close OUT;
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.