|
Hai-Etlik Newbie
Joined: 10 Sep 2009 Posts: 3
|
Posted: Thu Sep 10, 2009 1:29 am
XML parsing or reading Stdout of called program |
I'm not really a zMUD user but I'm trying to adapt a combination TinyFugue/Ruby script for someone who is but who doesn't know anything about programming.
I have XML files, I need to read one, and execute a series of timed actions based on it. I currently have a Ruby script that can do this and I can load and execute the output in TinyFuge with the /quote command. Is there any way to do this in zMUD? I skimmed the docs but didn't notice anything obvious.
Failing that, is there a way to parse XML in a script? |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Thu Sep 10, 2009 3:06 pm |
Generally speaking, there's nothing in zMUD specifically designed for parsing XML.
That said there are few options. The first (and most likely solution) is the MXP protocol. It allows the user to define their own custom XML tags and how zMUD should respond to them.
If there is a Ruby implementation that is Windows Scripting Host (WSH) compliant, you can use it to write scripts and triggers in Ruby.
Other commands that might be useful to you are #FILE, #READ, #CLOSE, #WRITE, #SEND, #TYPE and #LOG.
I hope that helps. |
|
_________________ Asati di tempari! |
|
|
|
Hai-Etlik Newbie
Joined: 10 Sep 2009 Posts: 3
|
Posted: Thu Sep 10, 2009 5:34 pm |
Hmm, looks like the closest I'll be able to manage is outputting zMUD script to a file and then loading that as a separate step.
|
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Thu Sep 10, 2009 8:14 pm |
Can you explain in more detail what exactly you're trying to accomplish? the more information you provide the more insight you can receive as to the best approach.
|
|
_________________ Asati di tempari! |
|
|
|
Hai-Etlik Newbie
Joined: 10 Sep 2009 Posts: 3
|
Posted: Fri Sep 11, 2009 1:23 am |
The XML files are songs with timing information, indications of chorus/verse structure, spoken words, and actions. The idea is to have the song in a form that can (In theory) be used by any client, on any MUD, by any character, and which can be viewed in a web browser with XSLT.
I'll admit it's overkill but it's overkill that I'm rather proud of.
Right now the Ruby script can produce a simple set of commands appropriate to either Bards or Non-Bards on the MUD I play, (The Bard class gets special commands for singing nicely formatted songs) and it can do so plain, plain but with delays, or as TinyFugue commands to handle the timing. In TF I can call the script and execute the output as if I were loading a saved script using the /quote command.
Code: |
/def sing = /quote -S -dexec !ruby ./retro/songs/retrosing.rb -gbard -rchangeling -ctf <./retro/songs/%{1} |
|
|
|
|
|
|