![](templates/Classic/images/spacer.gif) |
Rolly Wanderer
Joined: 16 Oct 2006 Posts: 62
|
Posted: Fri Jan 26, 2007 12:31 am
Capturing possible followers |
Hi, here is a really simple one, I hope. I need the syntax to capture a name that may or may not be there. I built a trigger that will check every so often using the Entourage command for anyone following me in Achaea. Here is the trigger:
#Trigger {The following adventurers are in your entourage: (%w)}
{#SHOW "%1"
#Var Follower "%1"
#WAIT 60000
ent}
The trigger does not work because there is usually no name to capture.
I'm sure there is something that will work in place of (%w) so that if there is now one in my entourage it will still trigger the last two statements but i do not know what it is. Can someone please help? Thanks in advance. |
|
|
![](templates/Classic/images/spacer.gif) |
Fang Xianfu GURU
![](images/avatars/1763170544a2093e7e85da.gif)
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Jan 26, 2007 1:34 am |
One way of doing it would be with a reparse state:
#trig {The following adventurers are in your entourage:} {blah blah}
#cond {The following adventurers are in your entourage: (%w)} {blah blah} {reparse}
But since all you want it to do is check every minute and using #wait, especially for something like this, is a very bad idea, I suggest the alarm command.
#alarm **:**:00 {ent}
or
#alarm 60 {ent}
which is entirely separate to the trigger, which would be
#trig The following adventurers are in your entourage: (%w)} {blah blah} |
|
|
![](templates/Classic/images/spacer.gif) |
gamma_ray Magician
Joined: 17 Apr 2005 Posts: 496
|
Posted: Fri Jan 26, 2007 2:30 am |
The problem with that method is that if there are no followers, then the variable will -not- be set to empty, i.e. the variable will still think there are followers.
You can do a reparse in which the first state clears the variable and the second state sets it if there -are- followers.
Alterntively, you can use * instead of %w. %w matches any number of letter characters (i.e. a-z) so it wouldn't work completely correctly if you had several followers. * will catch anything, including "nothing", so it should always function in a reliable manner (for one line or less). Of course you take a performance hit but it's probably not -that- bad.
You might want to look at the Pattern Matching page in the ZMud help files, too, in your free time as it outlines all of the different pattern options. (Or just come join me on the dark side of RegEx...) |
|
|
![](templates/Classic/images/spacer.gif) |
|
|