heres a perl script to translate zmud style speedwalks into tinyfugue commands
#!/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
this one fixes bugs where direction count > 10 and consecutive nondirectional commands
#!/usr/bin/env perl
# z2tf.pl
#convert zmud speedwalks into tinyfugue commands
# usage: z2tf.pl '3nes2we;open door;'
use strict;
use warnings;
my $zwalk = shift;
my @walks = split ';', $zwalk;
my $count;
foreach my $walk (@walks) {
while ($walk ne '') {
if ($walk =~ /^([0-9nsewud]+)$/) {
if ($walk =~ s/^(\d+)//) {
$count = $1;
} else {
$count = 1;
}
$walk =~ s/^(.)//;
my $char = $1;
while ($count > 0) {
print "${char}%;";
$count--;
}
} else {
print "${walk}%;";
$walk = '';
}
}
}
print "\n";Good job!