Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Multiline/Regular Expression Help

Multiline/Regular Expression Help

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Pesmare   Australia  (4 posts)  Bio
Date Sun 29 Jan 2006 06:29 AM (UTC)
Message
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
Top

Posted by Ked   Russia  (524 posts)  Bio
Date Reply #1 on Sun 29 Jan 2006 09:58 AM (UTC)
Message
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.
Top

Posted by Pesmare   Australia  (4 posts)  Bio
Date Reply #2 on Mon 30 Jan 2006 07:04 AM (UTC)
Message
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?
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Mon 30 Jan 2006 07:45 PM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


14,075 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.