|
Spectrum Beginner
Joined: 13 Feb 2003 Posts: 13 Location: Philippines
|
Posted: Tue Mar 09, 2004 2:07 pm
using wildcards | and ^ |
I wanna make a trigger that triggers when the statement is at the start of the line or one that is before the prompt.
So example below:
<258hp 100m 500mv>Darker throws a fireball.
-OR-
Darker throws a fireball.
Now if I put the ^ then it will trigger on the second example but sometimes its connected to the prompt because of reasons I dont really know its with the mud. So how do this on 1 trigger? using {^|<258hp 100m 500mv>}Darker throws a fireball doesnt work. |
|
|
|
Theragil Apprentice
Joined: 13 Feb 2004 Posts: 157 Location: USA
|
Posted: Tue Mar 09, 2004 2:45 pm |
Probably the simplest way is to put the actions you want into an alias, then make two triggers, both of which call the alias. One trigger being {^Darker throws a fireball.$} and the other being {^~<(%d)hp (%d)m (%d)mv~>Darker throws a fireball.$} The extra advantage of this is if you need to fire off those events manually you have an alias to do it with.
|
|
|
|
Spectrum Beginner
Joined: 13 Feb 2003 Posts: 13 Location: Philippines
|
Posted: Tue Mar 09, 2004 3:02 pm |
so there is no way to put it in one trigger you will need 2 triggers to do this?
|
|
|
|
omaek193 Novice
Joined: 10 Oct 2002 Posts: 30 Location: Italy
|
Posted: Tue Mar 09, 2004 4:44 pm |
Personally I am very interested in this topic.
I encountered the same issue and I have double set for delicate triggers.
If anyone have a more elegant and/or performing solution... |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue Mar 09, 2004 8:11 pm |
Yes, you can put it in one trigger but only if you don't anchor it to the beginning of the line.
The simplest solution is not to use an anchor. This may be combined with the %q wildcard, if desired, so you won't trigger on MrDarker, etc.
Darker throws a fireball
or
%qDarker throws a fireball
Wildcards aren't allowed inside the stringlist pattern, as you can see if you look it up, so there's no way to match your prompt with a stringlist pattern. Thus, there's no way to combine the start-of-line pattern with the following-prompt pattern.
quote: {val1|val2|val3|...} match any of the specified strings can not use other wildcard inside this
If a start-of-line anchor is necessary you'll have to use two triggers. It doesn't really take very long to copy a trigger and make a small modification to it's pattern. |
|
|
|
lethe Beginner
Joined: 25 Sep 2003 Posts: 14
|
Posted: Tue Mar 09, 2004 9:05 pm |
Regexp triggers is what you want!
#REGEX {^(?:<d+hpsd+msd+mv>)?Darker throws a fireball} {throw fireball again or somesuch}
Explaining the Regex:
The part with parenthesis is one pattern. Starting it with ?: means it won't get stored in a variable. is regex escape character. d+ means 1 or more digits. s means space. The ? after the pattern means 0 or 1 of the preceding pattern. So it triggers on both.
Read up on regex. They will be a revolution once you understand em. |
|
|
|
Theragil Apprentice
Joined: 13 Feb 2004 Posts: 157 Location: USA
|
Posted: Wed Mar 10, 2004 12:05 am |
Keep in mind that the two-triggers approach I suggested does not require you to duplicate anything but the trigger -- you make an alias that contains the action, and then both triggers only call the alias, no more. Very simple.
The regexp trigger avoids this, of course, but it's really a question of which one is easier for you to maintain. If you are comfortable with regexp, go that way; if you look at that and your eyes glaze over, go for the two-trigger system. Because someday you're going to be staring at this trigger saying "why did I put this in here, and how can I fix it to work with this new change in the MUD?" Using the one that makes sense to you is what'll be best when that day comes. |
|
|
|
lethe Beginner
Joined: 25 Sep 2003 Posts: 14
|
Posted: Wed Mar 10, 2004 12:43 am |
Learning regexp well enough for zmud needs is time _very_ well invested. Imho it's the single most powerful addition to zmud. :)
|
|
|
|
|
|