|
nastasim Beginner
Joined: 08 Jun 2004 Posts: 10
|
Posted: Sat Jul 03, 2004 2:43 am
Trigger Question |
Sometimes a target name (i.e. guard) can be for different types of mobs (the castle guard, the boggie guard, etc). I use cold spells on the target "guard" but that doesn't work on boggie guards - there i need water spells. So I need a way to set the spell type based on the mob i am fighting. I have a prompt that shows me the mob and its condition already, I am thinking a pattern match on it would be the answer. Here is a mud line example of this prompt:
Fighting: [the boggie guard/Few scratches]>
here is the pattern that I hope will match it:
^Fighting: [(%w)/(%w)]>
When I test this pattern ZMUD says "pattern does not match"!
Here is my trigger attempt. (If the spelltype is already Water, I am not going to change it):
#if ((%1={the boggie warrior} or %1={the boggie guard} or %1={the boggie priest}) and @spelltype <> Water) {
ss water
#SHOW TRIGGER CHANGED SPELLTYPE TO WATER
}
Is there a problem with my pattern?
Is the trigger ok?
Thank you,
Mario |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sat Jul 03, 2004 7:09 am |
Is there a problem with my pattern? Yes. It doesn't match.
Reading the relevant items in the Pattern Matching helptopic would have shown you that your pattern is wrong.
%w . . . . . match any number of alpha characters (a-z) (a word)
Since you clearly have non-alpha characters, such as spaces, on both sides of the /, and on both sides of the / it is obviously more than "a word", it should not surprise you that %w doesn't match.
In addition, your pattern includes the characters [] which are also pattern-matching characters, and you haven't bothered to quote them out.
[range] . . .match any amount of characters listed in range
With those around most of your pattern, you aren't even trying to match alpha strings, but instead are looking for strings whose only characters are (, %, w, /, or ).
Corrected pattern:
^Fighting: ~[(*)/(*)~]>
Is the trigger ok? No.
If you expect %1 to be more than one word, it must be enclosed in grouping symbols such as "". It would be best to use "" on both sides of the string comparisons. You should also group the final comparison.
Corrected Value:
#if (("%1" = "the boggie warrior" or "%1" = "the boggie guard" or "%1" = "the boggie priest") and (@spelltype <> Water)) {
ss water
#SHOW TRIGGER CHANGED SPELLTYPE TO WATER
} |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|