It's in perl and you need to grab an xml package for it to run. I've been meaning to unlearn perl but I already know it and it's something I can do really fast.
This is also super rough and won't work for every case, and it doesn't follow button targets properly or anything. It also goes with the assumption that the page ids are "<text><number>", then groups them together based on that.
So if you have page id's of "girl1" "girl2" It'll just group them under a 'girl' category and id them 1 2 3 etc. Okay well the more I look at this the more it sucks, but this was the quick and dirty so I can paste each girl sequence in a file and do some hand tweaking.
But idea is just parse each page, put it in a hashmap by the id, then spit out scriptengine format of them. So top loop xml parse and build, bottom loop print it. Hopefully at the least it is slightly useful.
Code: Select all
#!perl -w
use strict;
use warnings;
use XML::LibXML; #CPAN/ppm xml-libxml
use File::Basename;
my $config_fn = "bm.xml";
my $parser = XML::LibXML->new();
my $curr_doc = $parser->parse_file($config_fn);
my %list;
for my $page ( $curr_doc->findnodes('/Tease/Pages/Page') )
{
my $id = $page->getAttribute('id');
my ($id_num) = $id =~ /(\d+)/;
my ($id_text) = $id =~ /([a-zA-Z]+)/;
my $text = $page->findvalue("Text");
my $img = $page->findvalue("Image/\@id");
my $audio = $page->findvalue("Audio/\@id");
my $delay = $page->findvalue("Delay/\@seconds");
my $btn_targ = $page->findvalue("Button/\@target");
my $btn_txt = $page->findvalue("Button");
my( $img_nm, $img_path) = fileparse($img);
if( defined( $id_text) )
{
$list{$id_text}{img_path} = $img_path;
$list{$id_text}{ids}{$id}{text} = $text;
$list{$id_text}{ids}{$id}{audio} = $audio;
$list{$id_text}{ids}{$id}{delay} = $delay;
$list{$id_text}{ids}{$id}{img_nm} = $img_nm;
$list{$id_text}{ids}{$id}{btn_targ} = $btn_targ;
$btn_txt =~ s/,/\.\.\./gi;
$list{$id_text}{ids}{$id}{btn_txt} = $btn_txt;
}
}
for my $id_text ( sort keys %list )
{
print "$id_text:\n";
print "imgFolder $list{$id_text}{img_path}\n";
print "audioFolder /Audio\n";
for my $id ( sort keys %{$list{$id_text}{ids}} )
{
print "$list{$id_text}{ids}{$id}{img_nm},";
if( $list{$id_text}{ids}{$id}{delay} ne "" )
{ print "$list{$id_text}{ids}{$id}{delay},"; }
print "{\n";
if( $list{$id_text}{ids}{$id}{audio} ne "" )
{ print "\taudio $list{$id_text}{ids}{$id}{audio}\n"; }
if( $list{$id_text}{ids}{$id}{btn_txt} ne "" )
{ print "\tButton $list{$id_text}{ids}{$id}{btn_txt}\n"; }
print "\t$list{$id_text}{ids}{$id}{text}\n";
print "}\n\n";
}
}