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
➜ VBscript
➜ 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 page
Posted by
| Natasi
(79 posts) 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>
| Top |
|
Posted by
| Ked
Russia (524 posts) 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\.)$
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) 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 | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) 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 | Top |
|
Posted by
| Natasi
(79 posts) 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. | 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.
18,542 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top