I'm fairly new to MUSHclient (Great program! I love it!). I've been trying to do something farily ambitious with parsing all of the text that comes from a MUD (which is wrapped in XML tags) and returning it, parsed and modified in some cases, to the output window. I've gotten a lot of it working, but I'm having some problems with multi-line triggers. Here's an example of the data that I'm trying to match:
The indented lines above are where the newlines occur. (Edit: Whoops! Sorry for the wide screen. Though I guess that shows that we're really lookin at multiple lines. The whole thing shows up as about 12 lines on my output widow. I've trimmed the first two lines to be shorter).
More generically, it will be in the form of: "<s-sometag optional='arguments'>Some multiline data</s-sometag>"
What I'm trying to do is pass this data to an XML parser that will strip off the tags, save any options, and return the data to the output window.
Unfortunately, one of the problems that I have is that I don't know how many lines I'll get. If I do a WHO command, I could get 150 lines.
I think I need one of two things: Either a good way to recombine the multiple lines back into one data structure that I can pass to my XML parser (I tried just concatenating the strings together, but the parser choked), or a way to trigger on a start tag, send the following data to the parser, and stop sending when it reaches an end tag. Is there any way to say "Once I match <s-something>, grab everything until </s-something> and then process it all"? Or even to just continually grab all of the data from the MUD and process it every time we see an end tag?
I realize this is probably something that MUSHclient wasn't originally intended to do, and if it's beyond the scope of the client I understand. But if it's at all possible, I'd love to be able to get it to work.
Oh, and the parser that I'm using is in Python, but I'm also familiar with VBScript and could possibly use that. And the parser works fine if I hand it a single line complete with both tags. In fact, my workaround right now is to first detect a few single-line cases, and then after that I will detect a start tag by itself, and then wrap that with an end tag and process is, or an end tag by itself, and wrap that with a start tag and process it. Unfortunately, in the case of 3 or more lines, the middle lines don't get processed.
Any ideas or help would be greatly appreciated.
Thanks!
<s-new-loc loc-num='2082' name='Shipyard' w='2081'> This is a desolate location. There are no ships here ...
Siryn's laws will allow spaceship repairs here only, to reduce the impact on the environment ...
The only way out is to the landing pad to the west.</s-new-loc>The indented lines above are where the newlines occur. (Edit: Whoops! Sorry for the wide screen. Though I guess that shows that we're really lookin at multiple lines. The whole thing shows up as about 12 lines on my output widow. I've trimmed the first two lines to be shorter).
More generically, it will be in the form of: "<s-sometag optional='arguments'>Some multiline data</s-sometag>"
What I'm trying to do is pass this data to an XML parser that will strip off the tags, save any options, and return the data to the output window.
Unfortunately, one of the problems that I have is that I don't know how many lines I'll get. If I do a WHO command, I could get 150 lines.
I think I need one of two things: Either a good way to recombine the multiple lines back into one data structure that I can pass to my XML parser (I tried just concatenating the strings together, but the parser choked), or a way to trigger on a start tag, send the following data to the parser, and stop sending when it reaches an end tag. Is there any way to say "Once I match <s-something>, grab everything until </s-something> and then process it all"? Or even to just continually grab all of the data from the MUD and process it every time we see an end tag?
I realize this is probably something that MUSHclient wasn't originally intended to do, and if it's beyond the scope of the client I understand. But if it's at all possible, I'd love to be able to get it to work.
Oh, and the parser that I'm using is in Python, but I'm also familiar with VBScript and could possibly use that. And the parser works fine if I hand it a single line complete with both tags. In fact, my workaround right now is to first detect a few single-line cases, and then after that I will detect a start tag by itself, and then wrap that with an end tag and process is, or an end tag by itself, and wrap that with a start tag and process it. Unfortunately, in the case of 3 or more lines, the middle lines don't get processed.
Any ideas or help would be greatly appreciated.
Thanks!