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
➜ addxml timers
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| ReallyCurious
USA (50 posts) Bio
|
Date
| Thu 24 May 2007 09:05 PM (UTC) |
Message
| require "addxml"
addxml.timer {name = "test1",
enabled = true,
second = 5,
send_to = 12,
one_shot = true,
send = print("hello"),
print("how are you")
}
I want to create a labeled timer similar to this but not have it fire when it's created, but to fire 5 seconds after it's created. Can I do this? | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #2 on Fri 25 May 2007 05:17 AM (UTC) |
Message
| You are not quoting the send text. It should read:
require "addxml"
addxml.timer {
name = "test1",
enabled = true,
second = 5,
send_to = 12,
one_shot = true,
send = [[
print("hello")
print("how are you")
]]
}
The way you have done it, the print statements are evaluated immediately, because they are evaluated at addxml.timer time, not when the timer fires. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Shaun Biggs
USA (644 posts) Bio
|
Date
| Reply #3 on Fri 25 May 2007 09:07 AM (UTC) |
Message
| I tested that out, and it worked fine, but I didn't think that it was waiting the 5 seconds. I set second=59, and it still was firing within two seconds. Adding offset_second=59 to that as well still did not delay the printing more than 2 seconds. This is with MC 4.05 |
It is much easier to fight for one's ideals than to live up to them. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #4 on Fri 25 May 2007 11:08 PM (UTC) |
Message
| You are right, there is a bug in ImportXML where it doesn't reset a new timer.
I will correct that in the next version.
Meanwhile, in your example, adding the line:
ResetTimer ("test1")
... after addxml.timer, will fix it.
What MUSHclient does, is reset all timers after loading a new world, so for a full load, timers will be reset. However when the ImportXML functionality was added, the need to reset individual timers was overlooked. |
- 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.
18,621 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top