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
➜ General
➜ "\b" and Triggers
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Serris
(12 posts) Bio
|
Date
| Sun 06 Dec 2009 03:59 AM (UTC) |
Message
| I have a script that highlights a list of names using (@!enemies) and I also have a script that announces if one of them enters or leaves the area. The highlighter matches \b(@!enemies)\b. The problem I have is that the other script that announces when they enter/leave doesn't work while \b is used. Is there a way to make both work?
These are the exact matching lines.
Highlighter: \b(@!enemies)\b
Announcement: ^(\w+) has (entered|left) the area\.$
This one highlights all people entering/leaving the area so I added this in the script field
if "%1" == "(@!enemies)" then
Send("ct %1 in!")
end
I hope this is clear enough and thanks for any insight. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sun 06 Dec 2009 06:06 AM (UTC) |
Message
| This won't work:
if "%1" == "(@!enemies)" then
I presume in the enemies variable is a list of enemies, however the %1 == <something> matches an exact string, not some sort of list.
You would need to put the enemies in a table, and then do a table-lookup to see if it matches one of them.
Or, maybe:
Announcement: ^\b(@!enemies)\b has (entered|left) the area\.$
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Serris
(12 posts) Bio
|
Date
| Reply #2 on Mon 07 Dec 2009 01:27 AM (UTC) |
Message
| ^\b(@!enemies)\b has (entered|left) the area\.$
That doesn't seem to work while I have another trigger that highlights using \b(?:@!enemies)\b. When that's removed, the announcement trigger works perfectly.
Right now I have a list with a lot of names in the variable "enemies" and it look like this: Name1|Name2|Name3|Name4... I tried making a table before but failed miserably and crashed MUSH a few times. This was the easiest way to highlight names for me at least.
Would there be any other way to make these two compatible using just the match field? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Mon 07 Dec 2009 04:57 AM (UTC) |
Message
| Well, it should work. We need more information.
 |
Please help us by advising:
- The version of MUSHclient you are using. Use the Help menu -> About MUSHclient.
- A copy of the trigger, alias or timer you were using (see
Copying XML)
- The output from the MUD that caused the problem
- The error message, if any, that you got (or other relevant output)
|
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Larkin
(278 posts) Bio
|
Date
| Reply #4 on Mon 07 Dec 2009 02:44 PM (UTC) |
Message
| Do your triggers have the 'keep evaluating' option set? | Top |
|
Posted by
| Serris
(12 posts) Bio
|
Date
| Reply #5 on Tue 08 Dec 2009 03:47 AM (UTC) |
Message
| Ah, sorry.
The version is 4.40
Here is the Highlight Trigger:
<triggers>
<trigger
custom_colour="7"
enabled="y"
expand_variables="y"
group="highlighter"
match="\b(?:@!enemies)\b"
regexp="y"
repeat="y"
sequence="100"
>
</trigger>
</triggers>
And here's the Announcement Trigger:
<triggers>
<trigger
enabled="y"
expand_variables="y"
match="^\b(@!enemies)\b has entered the area\.$"
regexp="y"
repeat="y"
sequence="100"
>
<send>
pt %1 has entered the area.</send>
</trigger>
</triggers>
Larkin: Yeah, both of them I tried "Repeat on Same Line" then one without and one with. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #6 on Tue 08 Dec 2009 04:04 AM (UTC) Amended on Tue 08 Dec 2009 04:05 AM (UTC) by Nick Gammon
|
Message
| No, you didn't have "keep evaluating" set. Without that set, only one will match if both are candidates. With it set (on both of them) it works:
<triggers>
<trigger
custom_colour="7"
enabled="y"
expand_variables="y"
group="highlighter"
keep_evaluating="y"
match="\b(?:@!enemies)\b"
regexp="y"
repeat="y"
sequence="100"
>
</trigger>
<trigger
enabled="y"
expand_variables="y"
keep_evaluating="y"
match="^\b(@!enemies)\b has entered the area\.$"
regexp="y"
repeat="y"
sequence="100"
>
<send>
pt %1 has entered the area.</send>
</trigger>
</triggers>
Example:
You see Name1.
Name1 has entered the area.
pt Name1 has entered the area.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Serris
(12 posts) Bio
|
Date
| Reply #7 on Tue 08 Dec 2009 04:58 AM (UTC) |
Message
| I was confusing "Keep Evaluating" with another option. It works now as you said. Thanks for the help! | 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.
25,014 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top