Be careful to use wait.lua [solved]

Posted by Yanwuhuan on Fri 11 Jan 2013 04:37 PM — 4 posts, 15,918 views.

#0
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.
Australia Forum Administrator #1
I think I would need to see your code to comment. You may have a simple race condition, or you may have a trigger in the wait that is too general (ie. matching anything).
#2

Yes, you're right.
I test it in a pure environment, it works.

Please mark this post as "invalid post" :)
Australia Forum Administrator #3
I'll mark it solved.