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 ➜ Suggestions ➜ Regular expression wildcard for multiple variables inside itself

Regular expression wildcard for multiple variables inside itself

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


Posted by ErockMahan   (81 posts)  Bio
Date Thu 17 Oct 2013 11:04 PM (UTC)
Message
Boy, that subject doesn't seem very clear! Examples are the best:


I have a variable:

<variables>
<variable name="customcommand">armorGG|blindTT</variable>
</variables>



I have a regex trigger:

^@leader tells you \'(@!customcommand)\'$



This works fine when:

LeaderMan tells you 'armorGG'
LeaderMan tells you 'blindTT'




But what If I want it to do both?

LeaderMan tells you 'armorGG blindTT'


I COULD (and currently do) split the string into individual pieces and individually analyzed, but my suggestion is that this could be simplified.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 18 Oct 2013 02:13 AM (UTC)
Message
I'm not sure a complex regexp is the best way to go here.

How about matching on


@leader tells you '*'


Then take whatever-it-was he told you and match it against the commands?

- Nick Gammon

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

Posted by ErockMahan   (81 posts)  Bio
Date Reply #2 on Sun 20 Oct 2013 09:36 PM (UTC)
Message
You mean like:

if "%1"="armorGG" or "%1"="blindTT" then
world.execute "%1"
end if

?


Because this would work, I'm just trying to find a way to keep it simple. Trigger on:

@leader tells the group *
@leader tells you *
@leader whispers in your ear *

etc.

My workarounds (and yours) work fine, but like I said, it's an idea.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Sun 20 Oct 2013 10:29 PM (UTC)
Message
Not exactly, I was thinking of some sort of table look-up.

You know what "leader" told you. You scan through some table looking for a match. If you find it, you do whatever the matched thing was supposed to do.

- 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,632 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.