- Code: Select all
#!/usr/bin/env perl
#convert zmud speedwalks into tinyfugue commands
# usage: z2tf.pl '3nes2we;open door;'
use strict;
use warnings;
my $zwalk = shift;
my @chars = split //, $zwalk;
my $count = 1;
my $iscmd = 0;
my $cmd = '';
foreach my $char (@chars) {
if ($char =~ /\;/) {
if ($iscmd) {
print $cmd;
print '%;';
$cmd = '';
$iscmd = 0;
} else {
$iscmd = 1;
}
} elsif ($iscmd) {
$cmd = "${cmd}${char}";
} elsif ($char =~ /[nsewud]/) {
while ($count > 0) {
print $char;
print '%;';
$count--;
}
$count = 1;
} elsif ($char =~ /\d+/) {
$count = $char;
}
}
you can just use the output in a macro definition for your speedwalk