 |
Idruzor Newbie
Joined: 01 May 2015 Posts: 2
|
Posted: Fri May 01, 2015 2:54 pm
Parse and remove XML tags |
My mud supports XML mode which adds XML tags around each line received, some examples:
Code: |
<hit>You cleave a striped snake's tail hard and shatter it.</hit>
<avoid_damage>A striped snake fails to hit you.</avoid_damage>
|
I am trying to write triggers that can remove the XML tags, but use them for parsing certain information. For example, everything inside <hit> is a hit in combat, so we know we are in combat and so on.
So for the hit message I wrote the following:
Code: |
<trigger priority="20220" case="true" id="2022">
<pattern>^<hit>(*)</hit>$</pattern>
<value>// #VAR combat 1
#SUB %1</value>
</trigger>
|
This gets rid of the <hit>-tags but the problem is I can't write further triggers on the hit line. Reading the #HELP #SUB says "substituted strings are not processed by further triggers", which is exactly what I want to do. Any way to get around this or do it in a different way? |
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4769 Location: Pensacola, FL, USA
|
Posted: Fri May 01, 2015 9:48 pm |
You might be able to use the XML tags to make an MXP trigger.
Have the priority of any other triggers set so that they go off before the #SUB.
Instead of #SUB you could just #SAY the extra text, or move it to another window, where it can then be fired upon.
To be honest, I don't think i have ever seen the substituted text ignored by other triggers unless i check that option on the trigger. |
|
_________________ Discord: Shalimarwildcat |
|
|
 |
Idruzor Newbie
Joined: 01 May 2015 Posts: 2
|
Posted: Fri May 01, 2015 11:47 pm |
The goal is to just use the XML tags to better capture output information from the MUD and remove them entirely from the output. For example for the hit trigger above I would like to write a pattern like:
^You cleave (*) and shatter it.$
which would actually be inside the <hit> XML tag. But if I make that trigger with priority after the #SUB trigger it never fires.
I have tried using #SAY but that seems to remove colors and bold formatting of the text. I'll explore further and try MXP, thanks. |
|
|
 |
|
|