Trigger, print the match?

Posted by Zeno on Fri 03 Aug 2007 01:16 AM — 2 posts, 7,129 views.

USA #0
I have a trigger that is using a few ors. Something like this:
hits you for (.*)|You dodge|(.*) looks up

I want to send what it matched on to the status bar. But I'm not sure how. I can't use %1 of course, that would just print one word. And since it's an or, I'm not sure what it would be matching.
Australia Forum Administrator #1
%0 is the whole match.

eg.


<triggers>
  <trigger
   enabled="y"
   match="hits you for (.*)|You dodge|(.*) looks up"
   regexp="y"
   send_to="2"
   sequence="100"
  >
  <send>%%0 = %0</send>
  </trigger>
</triggers>

Input line: 

  Nick hits you for 20

Prints:

  %0 = hits you for 20



Another possibility is to enclose the whole thing in brackets, eg.


 match="(hits you for (.*)|You dodge|(.*) looks up)"


Now %1 is "hits you for 20" and %2 is "20".