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.
 Entire forum ➜ MUSHclient ➜ Lua ➜ Follow up on "Match line IF other line is NOT there"

Follow up on "Match line IF other line is NOT there"

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


Posted by Blixel   (80 posts)  Bio
Date Tue 01 Dec 2020 06:24 PM (UTC)
Message
This is the thread I want to reply to, but it's too old at this point, so I can't reply direclty.

https://www.gammon.com.au/forum/?id=14057&reply=3#reply3

I want to make a plugin like the one Nick made for me so that it will match multiple conditions. I thought I could put a pipe symbol in the match line, but that doesn't seem to work.

Here is what I'm trying to match

Instead of: match="M - *"

I want: match="M - wererat|M - wererat, wererat|M - wererat, wererat, wererat"

It works if I just have match="M - wererat", but if I try to match 2 or 3 wererats, it doesn't work.

Does anyone know how I can modify this match line to match all three conditions?

Thank you.
Top

Posted by Fiendish   USA  (2,533 posts)  Bio   Global Moderator
Date Reply #1 on Tue 01 Dec 2020 07:29 PM (UTC)

Amended on Tue 01 Dec 2020 07:37 PM (UTC) by Fiendish

Message
First, why? "M - *" will also match all of those.

To answer, pipe will only work if you're using regular expression matching, which is not true by default. You have to add regexp="y" to the trigger xml tag and then put parentheses around all of the different options (read the section on Subpatterns in https://www.mushclient.com/scripts/doc.php?general=regexp to understand why).

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Blixel   (80 posts)  Bio
Date Reply #2 on Tue 01 Dec 2020 09:04 PM (UTC)
Message
Fiendish said:

First, why? "M - *" will also match all of those.


Hopefully this will make sense. I'm aware that "M - *" will match all. However, I need to know when a monster is a "wererat" (or "werewolf" or "werebear"). "M - *" tells me there is a monster in the room, but it doesn't tell me what kind it is. In my game, if you get attacked by a were-creature, you become infected and can turn into a were-creature yourself. There's a cure, but it's a lot easier to just avoid it in the first place.


Fiendish said:
To answer, pipe will only work if you're using regular expression matching, which is not true by default. You have to add regexp="y" to the trigger xml tag and then put parentheses around all of the different options (read the section on Subpatterns in https://www.mushclient.com/scripts/doc.php?general=regexp to understand why).


Ah, ok. So add regexp="y". Thanks a lot. I will read the link.
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.


11,804 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.