Well, wait.lua is very powerful module.
In fact, I use it for many conditions, which make trigger fewer and script is cleaner.
But seems it has some limitation.
This is a case:
cmd > ask dispatcher about job
mud 1> Dispatcher is thinking ...
This guy usually dispatch job after some seconds
Here I enable trigger to match mud 5
...
mud 2 > Ooops, your weapon is broken.
A function will be invoked, it used wait.
script send 1 > remove shield 1
wait.regexp "removed", like mud 3
mud 3> You removed your shield.
mud 4 > Job dispatcher said:
mud 5 > Your job target NPC is there....
This line should trigger something, but not.
script send 2 > wield sword
script send 3 > wear shield 1
So then script was over.
mud 6 > You wield your sword.
mud 7 > You equip your shield.
Seems the script function for mud 2 used wait, mud 5 not triggered.
I just enable mud 5 trigger if mud 1 appeared, and disable itself when it fired.
In this case, I check this trigger, it was enabled.
In fact, I use it for many conditions, which make trigger fewer and script is cleaner.
But seems it has some limitation.
This is a case:
cmd > ask dispatcher about job
mud 1> Dispatcher is thinking ...
This guy usually dispatch job after some seconds
Here I enable trigger to match mud 5
...
mud 2 > Ooops, your weapon is broken.
A function will be invoked, it used wait.
script send 1 > remove shield 1
wait.regexp "removed", like mud 3
mud 3> You removed your shield.
mud 4 > Job dispatcher said:
mud 5 > Your job target NPC is there....
This line should trigger something, but not.
script send 2 > wield sword
script send 3 > wear shield 1
So then script was over.
mud 6 > You wield your sword.
mud 7 > You equip your shield.
Seems the script function for mud 2 used wait, mud 5 not triggered.
I just enable mud 5 trigger if mud 1 appeared, and disable itself when it fired.
In this case, I check this trigger, it was enabled.