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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  Calling a wildcard in an alternate trigger match

Calling a wildcard in an alternate trigger match

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


Posted by Natasi   (79 posts)  [Biography] bio
Date Sat 27 Oct 2007 02:32 AM (UTC)
Message
Hey there, I'm having some trouble with this trigger here. I'm trying to match on the left or right, but the %1 calls out the entire line when I have it set up as an alternate type of trigger. Any way I can call that left|right to check for a match?

<triggers>
  <trigger
   enabled="y"
   group="aff"
   keep_evaluating="y"
   match="(^missing the (left|right) ear\.$|^Blood flows into your (left|right) side inner ear\, inhibiting your sense of balance\.$)"
   name="severedear_aff"
   regexp="y"
   repeat="y"
   send_to="12"
   sequence="100"
  >
  <send>if ("%1" = "right") Then
call diagcall ("severed_rightear")
elseif ("%1" = "left") Then
call diagcall ("severed_leftear")
end if</send>
  </trigger>
</triggers>
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Reply #1 on Sat 27 Oct 2007 03:04 AM (UTC)

Amended on Sat 27 Oct 2007 03:05 AM (UTC) by Ked

Message
Change the pattern to:


(?:^missing the (left|right) ear\.$|^Blood flows into your (left|right) side inner ear\, inhibiting your sense of balance\.$)


The first wildcard in your pattern was filled by the outermost capture group, so it always contained the entire matched string. Using "?:" after the opening bracket makes sure that the group isn't captured.

[EDIT]: Actually, make it:


^(?:missing the (left|right) ear\.|Blood flows into your (left|right) side inner ear\, inhibiting your sense of balance\.)$

[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Sat 27 Oct 2007 06:01 AM (UTC)
Message
Alternatively, each group (that is, thing in brackets) becomes its own wildcard, so I would have thought the first left/right would be %2, and the second left/right would be %3.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Sat 27 Oct 2007 06:51 AM (UTC)
Message
The other thing is to remove the "outer" brackets - you don't need them, and all that does is make the entire matching line be wildcard %1.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Natasi   (79 posts)  [Biography] bio
Date Reply #4 on Sat 27 Oct 2007 07:10 PM (UTC)

Amended on Sun 28 Oct 2007 02:19 AM (UTC) by Natasi

Message
Hmm, I tried removing the brackets and then it wasn't picking up the line at all. Thanks for the ?: suggestion I will try that in my triggers and see how it works.

I actually tried the %2/%3 also and it still didn't pick it up, it would only trigger the whole line as %1. I used note "%1", note "%2", and note "%3" to test this.
[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.


16,716 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 HostDash]