[Home] [Downloads] [Search] [Help/forum]

Log on
Register forum user name Search FAQ

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  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] Refresh page


Posted by Blixel   (72 posts)  [Biography] 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.
[Go to top] top

Posted by Fiendish   USA  (2,315 posts)  [Biography] 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
[Go to top] top

Posted by Blixel   (72 posts)  [Biography] 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.
[Go to top] 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.


840 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]