Two Triggers on the Same Line?

Posted by Noredil on Thu 14 Feb 2008 06:56 AM — 3 posts, 18,174 views.

#0
I've noticed after pulling my hair out a bit, that the reason some of my triggers won't fire, is that there are sometimes multiple triggers trying to fire on the same line. For example, I have the following two:

<trigger
enabled="y"
match="A nearly invisible magical shield forms around (.*)$"
custom_colour="9"
regexp="y"
script="mob_shield"
sequence="102"
>
</trigger>

<trigger
enabled="y"
expand_variables="y"
custom_colour="17"
group="colors"
ignore_case="y"
match="\b(@!target)\b"
regexp="y"
sequence="102"
script="targ_check"
other_text_colour="black"
other_back_colour="gold"
>
</trigger>

These two will not play nice together. I've tried playing around with the sequence number, but it seems like no matter what, the first trigger overrides the second (these are actually in two different XML files called by a main XML file)

For example, I put Note commands in the functions to see which of them were firing on these two examples... as you see, the first example, only the first trigger fires. In the second example, the second trigger does fire, suggesting it should have fired on the first line as well.

You say in Mhaldorian, "A nearly invisible magical shield forms around a mhun guy."
shield
8058h, 7310m, 29110w cexdb-
say A mhun guy
You say in Mhaldorian, "A mhun guy."
targ_check

Like I said, I've tried different combos of sequences, but that doesn't seem to be the issue here.
USA #1
One trigger needs to have a lower sequence than the other.
The issue is that you need to have the lower sequence trigger have the 'keep evaluating' option set, so that once that one fires it will check the line against the rest of the triggers you have.

-Onoitsu2
Amended on Thu 14 Feb 2008 09:16 AM by Onoitsu2
USA #2
Another thing to remember is to make sure that the higher sequence triggers will be evaluated. Use the keep_evaluating tag for that.

<trigger
  enabled="y"
  expand_variables="y"
  custom_colour="17"
  group="colors"
  ignore_case="y"
  match="\b(@!target)\b"
  regexp="y"
  sequence="99"
  keep_evaluating="y"
  script="targ_check"
  other_text_colour="black"
  other_back_colour="gold"
 >
</trigger>