Multiline/Regular Expression Help

Posted by Pesmare on Sun 29 Jan 2006 06:29 AM — 4 posts, 18,379 views.

Australia #0
Ok, I'm very new to multiline triggers, and even more so to regular expressions, so I could use a little help to be pushed into the right direction, so to speak.

What I am trying to do is have a box picking trigger, which matches on multiple lines, and omits it from output (as box picking is very spammy).

Here is what I am trying to match.


<5090hp4060m LVL53>
A sturdy iron-bound strongbox doesn't appear to be trapped.

Now, that may seem easy enough, but the 5090hp constantly changes, so it needs to be a variable. same as 4060 (but not the "m") and 53. So really, all numbers change.
The other thing that constantly changes is the "sturdy iron-bound strongbox", but it will always be 3 words. Not sure about the "-" though.
I did this as 2 triggers that omitted, originally, but then I realized that the prompt, which is anything from "<" to ">" I always need when not picking so...

Yeah, like I said, any help to push me in the right direction would be awesome. There's a whole lot more of these type of triggers, which I will probably eventually put in VBscript, but...for now, the help I receive will unlock the way to do the rest of them.

Thanks,
Pesmare
Russia #1
Is there really any point in matching both lines? The first one is a prompt, so its not part of the "box" output and shouldn't need to be included. In any case, a multi-line trigger can't omit any lines (or re-colour them, for that matter). If you really want to omit both lines then you'll need to use two triggers for it.

Still, more details on what you are trying to do are needed. This sentence: "I did this as 2 triggers that omitted, originally, but then I realized that the prompt, which is anything from "<" to ">" I always need when not picking so..." is especially confusing in the preceding context.
Australia #2
I mean that the prompt, which is: <5090hp4060m LVL53>
appears on every command. The picking of boxes etc, is only a small part of the MUD, and I need the prompt when not from those commands. When I omit everything but the prompt (as would happen with a single line trigger), I get this down the screen.

<5090hp4060m LVL53>

<5090hp4060m LVL53>

<5090hp4060m LVL53>

<5090hp4060m LVL53>

etc. What I really want to see is nothing at all. And then when the box is finally picked, I want to see a prompt, plus various things from the boxes, but thats already sorted out. So really, I want the process of picking to show nothing, but the end of picking to show my prompt plus what I got, as would be the normal echo from the MUD.


Does that make more sense?
Australia Forum Administrator #3
Quote:

What I am trying to do is have a box picking trigger, which matches on multiple lines, and omits it from output ...


It is a part of the design of multi-line triggers that you cannot omit them from output. This is in the help file for editing triggers:


"Because of the way they work some trigger processing is not available to multi-line triggers (eg. colouring lines, omit from output, omit from log)."


If you can imagine for a moment, a 50-line multi-line trigger, that has received, displayed, and logged the first 49 lines, then suddenly the 50th line arrives. It isn't really practical to "undraw" the previous 49 lines.

I think the simple solution in your case is to make a second trigger that also omits the prompt line, and enable that only when picking boxes.

Something like this:


Alias: pick box
Send: EnableTrigger "promptline", 0
      Send "pick box"
Send to: script


This effectively re-sends your "pick box" command to the MUD, plus disables the prompt line from appearing (assuming you add a suitable trigger to do so).

Then when you detect the box has been picked, re-enable the prompt line.