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
➜ Check if a trigger fires?
|
Check if a trigger fires?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Renny
Canada (26 posts) Bio
|
| Date
| Sat 25 Oct 2014 01:54 AM (UTC) |
| Message
| I took a look around but couldn't find any threads on this.
I want to create a timer that checks/listens to see if a trigger fires in X amount of time. If the trigger does not fire then do something else.
Is this possible? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Sat 25 Oct 2014 02:43 AM (UTC) |
| Message
|
- Clear a variable.
- Enable the trigger.
- Have the trigger set a variable if it fires.
- Start the timer.
- When the timer expires see if the variable has been set or not.
- Done.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Renny
Canada (26 posts) Bio
|
| Date
| Reply #2 on Sat 25 Oct 2014 05:57 AM (UTC) |
| Message
| Thanks!
One other question, I'm trying to get the quotes right for DoAfterSpecial but can't seem to.
local line = string.format("c %s %s", var, var2)
DoAfterSpecial(1, "Execute(line)", 12)
It's telling me
[string "Timer: "]:1: ')' expected near 'spellLine'
How can I fix these quotes? I've tried double, single and a bunch of other combinations. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Sat 25 Oct 2014 06:01 AM (UTC) Amended on Sat 25 Oct 2014 06:02 AM (UTC) by Nick Gammon
|
| Message
| Will "line" even exist at that point? Why not send to 'execute' rather than script?
Example:
DoAfterSpecial (2 , "dance" , sendto.execute )
Now instead of "dance" just put the thing you want to do after 2 seconds. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #4 on Sat 25 Oct 2014 06:04 AM (UTC) |
| Message
|
Renny said:
One other question, I'm trying to get the quotes right for DoAfterSpecial but can't seem to.
local line = string.format("c %s %s", var, var2)
Is this inside a trigger or alias ("Send" part)?
If so, the % symbols already have significance, so to use them for Lua purposes you have to double them, eg.
local line = string.format("c %%s %%s", var, var2)
That's because things like %1 mean "the first wildcard". |
- 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.
17,158 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top