Regular expression wildcard

Posted by ErockMahan on Sat 26 Jan 2013 01:08 AM — 4 posts, 19,200 views.

#0
I have a corpse collection set of triggers that activates on this:

You get Corpse of a Rat.

But every so often, when too many lines come through at once , my prompt ends up on the same line and I get this:

< 15973hp 238mana 102mv > You get Corpse of a Rat.

Now, without using regular expressions, I can do this:

*ou get * of *.

That way, whether the line starts with "Y" or "< 15973hp 238mana 102mv > Y" it will work just fine.

The problem, though, is that I have to do this as a regular expression (because it may not always be Corpse, but also Sludge, Remains, etc., but not "sword" or "helm" etc.)

With a regular expression, though, it doesn't seem to pick it up at all:

^(.*?)ou get (@!corpsetype) of (.*?)\.$

Now I know that the (@!corpsetype) works, because the trigger is perfectly fine whenever the line doesn't have the prompt show (You get Corpse of a Rat).

But whenever the line starts with < 15973hp etc, the trigger fails, and I would THINK that the (.*?) wildcard would account for that, but it doesn't seem to. I have tried it with and without the "ou" but nothing changes.

Is it possible to have a regular expression accomplish what I'm trying to do?
Amended on Mon 28 Jan 2013 05:13 PM by ErockMahan
Australia Forum Administrator #1
The conversion to regular expressions (done by the button in the trigger) is what it does anyway when a non-regular expression is processed. Please post the whole thing.

Template:copying
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.
#2
<triggers>
<trigger
expand_variables="y"
group="getcorpse"
match="^(.*?) get (@!corpsetype) of (@!elemental)\.$"
name="elementalcorpse"
regexp="y"
send_to="12"
sequence="300"
>
<send>world.note "elemental"
</send>
</trigger>
</triggers>
Australia Forum Administrator #3
The trigger was not enabled.

world.note doesn't work. It must be Note (not note).

At least post a trigger that works, thanks.

Using a modified trigger:


<triggers>
  <trigger
   enabled="y"
   expand_variables="y"
   group="getcorpse"
   match="^(.*?) get (@!corpsetype) of (@!elemental)\.$"
   name="elementalcorpse"
   regexp="y"
   send_to="12"
   sequence="300"
  >
  <send>Note "elemental"
</send>
  </trigger>
</triggers>


It worked in both cases:


You get Corpse of a Rat.
elemental
< 15973hp 238mana 102mv > You get Corpse of a Rat.
elemental


I suspect another trigger is kicking in on the prompt, preventing this one from firing. Make sure your "prompt" trigger is set as "keep evaluating".