Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Lua ➜ Be careful to use wait.lua [solved]

Be careful to use wait.lua [solved]

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Yanwuhuan   (15 posts)  Bio
Date Fri 11 Jan 2013 04:37 PM (UTC)
Message
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.
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 11 Jan 2013 10:15 PM (UTC)
Message
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).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Yanwuhuan   (15 posts)  Bio
Date Reply #2 on Sat 12 Jan 2013 03:47 AM (UTC)
Message

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

Please mark this post as "invalid post" :)
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 12 Jan 2013 04:13 AM (UTC)
Message
I'll mark it solved.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


14,269 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.