Trigger trouble...?

Posted by JayD on Thu 05 Dec 2002 02:28 PM — 5 posts, 19,211 views.

#0
I'm sure I'm missing something extraordinarily simple here, but I can't figure out for the life of me what is wrong. I've got a few triggers that should in theory fire off repeatedly until a certain condition is met, then quit, but it seems that the trigger will only fire once, then stop. The trigger I'm trying to use right now is fairly simple, it should react to the text "A stone is filled with power." echoing back "cast recharge stone". This seems simple, except that it does it once, reacting to the initial instance of "A stone is filled with power." but not the subsequent instance. What am I missing?

TIA
Australia Forum Administrator #1
Can you paste the exact trigger here? Find it in your trigger list and click on the "copy" button, and then paste it into a message.

Also, copy and paste from the output window an example of when it matches, and when it doesn't.
#2
Here is the trigger that I'm working with presently:

<triggers>
<trigger
enabled="y"
match="A sparkling mana stone glows as you store mana in it."
sequence="100"
>
<send>cast recharge sparkling</send>
</trigger>
</triggers>

Here is me trying to use it:

c recharge spark
A sparkling mana stone glows as you store mana in it.
cast recharge sparkling

[100%|96%|100%] A sparkling mana stone glows as you store mana in it.

It can be noted that just a moment ago it seemed to be working, but has stopped working just as quickly as it had started.
#3
Are you sure that you don't have a ^ before "A sparkling mana stone glows as you store mana in it." It seems to me that since in your first example, the trigger fired when "A sparkling mana stone glows as you store mana in it." was on it's own line, but when it showed up on the same line as your prompt, it didn't fire.
USA #4
Actually Sleeve's suggesting is right on the money, though not entirely accurate. Triggers use two forms, standard and regular expressions. They differ thus:

normal>
A happy smile. - Matches
[10%|20%|10%] A happy smile. - Fails

regexp>
A happy smile. - Matches
[10%|20%|10%] A happy smile. - Matches

This is do to the fact that normal triggers assume that the input 'starts' at the beginning of the line. Your second line fails because the string you are matching is no longer the first thing on the line.

You can fix this the easy way, or a slightly more complex, but more accurate way. The easy way would be to add * to the start of the text you are going to match like:

*A sparkling mana stone glows as you store mana in it.

This will work, but will match on 'any' case where is appears, including if someone gets smart and dumps it on channel traffic. A better solution would be to make the trigger a regular expression and make it:

^(\[.*|.*|.*\] )?A sparkling mana stone glows as you store mana in it\.

This will then match 'only' on lines like:

A sparkling mana stone glows as you store mana in it.
[100%|96%|100%] A sparkling mana stone glows as you store mana in it.

but not in lines which you don't want like:

Fred tells you: A sparkling mana stone glows as you store mana in it.

Thus the proper replacement would be:
<triggers>
  <trigger
  enabled="y"
  match="^(\[.*|.*|.*\] )?A sparkling mana stone glows as you store mana in it\."
  sequence="100"
  regexp="y"
  >
  <send>cast recharge sparkling</send>
</trigger>
</triggers>