Simple question about triggers

Posted by Penguin on Sun 14 Jul 2002 01:06 AM — 2 posts, 11,747 views.

#0
Hi,
I have problems dealing with my prompt when I trigger on a room name. If I were to trigger on a room name like for example "A tavern", sometimes it will just show "A tavern" but sometimes it appears as "HP:200 EP:200 A tavern"
Currently I'm setting two triggers.. one for "A tavern" and another for "HP:* EP:* A tavern" It's getting pretty troublesome and I was wondering if there's any way to just set 1 trigger.
Thanks
Canada #1
Regular Expressions can solve your dilema... but they can be tough to learn.

Try taking the second trigger, and click the "Convert to regular expression" button on that triggers screen.

Now, take what is optional text, and wrap it in brackets, then place a ? immediately after the closing bracket. In this case, what you want may look like this:

^(HP\:(.*?) EP\:(.*?) )?A tavern$

Learning the regular expression syntax can be a bit daunting, but once you get a grasp of it, you can build much better triggers and aliases that are more full-proof and more flexable. Start by clicking help on the trigger menu and following the appropriate links in the help file.

I believe there is a standalone file in the MUSHclient directory that is helpful as well. Yes, I just checked. It's called "RegularExpressions.txt". Read it for more help. :)