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
➜ Bug reports
➜ Can NOT SetTimerOption for "second"
|
Can NOT SetTimerOption for "second"
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Jcl2016
(8 posts) Bio
|
| Date
| Mon 28 Nov 2016 03:12 AM (UTC) |
| Message
| No matter what I set to the "second" option, the timer will be triggered at 0 second.
SetTimerOption("xxx", "second", 9)
Note(GetTimerOption("xxx", "second")) -- result is 0.
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Mon 28 Nov 2016 04:16 AM (UTC) |
| Message
| I can't reproduce that. I got "9" printed.
 |
Please help us by advising the version of MUSHclient you are using. Use the Help menu -> About MUSHclient.
|
Does the timer exist? What scripting language are you using? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Jcl2016
(8 posts) Bio
|
| Date
| Reply #2 on Mon 28 Nov 2016 05:42 AM (UTC) |
| Message
|
Nick Gammon said:
I can't reproduce that. I got "9" printed.
(version)
Does the timer exist? What scripting language are you using?
Version 5.02. The scripting language is Lua.
The timer is definitely there,it is "at the time" timer.
( The "every interval" timer is correct. ) | | Top |
|
| Posted by
| Fiendish
USA (2,541 posts) Bio
Global Moderator |
| Date
| Reply #3 on Mon 28 Nov 2016 05:38 PM (UTC) |
| Message
| I also can't reproduce this. Just for completeness, can you verify that copying/pasting this code exactly still prints 0 instead of 9?
AddTimer("xxx", 0, 0, 1.5, "", timer_flag.OneShot, "")
SetTimerOption("xxx", "second", 9)
Note(GetTimerOption("xxx", "second"))
|
https://github.com/fiendish/aardwolfclientpackage | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #4 on Mon 28 Nov 2016 08:56 PM (UTC) |
| Message
| I can reproduce it with an "at" timer. There is definitely a bug there, introduced when the seconds field became a floating point (so you can have 0.1 seconds).
I suggest as a work-around that you delete and re-add the timer. Or use "addxml.lua" module: http://www.gammon.com.au/forum/?id=7123
For example:
require "addxml"
addxml.timer { at_time = true,
hour = 23, minute = 15, second = 16.8,
send = "Timer fired!",
send_to = sendto.output,
enabled = true,
name = "whatever",
}
If you give a name to the timer it replaces another one of the same name (if any).
However perhaps you don't really want an "at" timer? I think this has gone unreported for so long because usually an "at" timer is for stuff like rotating your log files once a day, at midnight, and no-one cares if it is done at midnight or midnight + 5 seconds.
If you are trying to know when something happens in the near future (where 9 seconds would make a difference) like when a spell wears off, you are probably better off with an "every" timer, and make it "one-shot". A one-shot timer fires once and then deletes itself. This would be easier anyway because you probably know the interval, and using an "at" timer means you have to take the interval, add in the time right now, and get the time in the future when you want it to fire. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Fiendish
USA (2,541 posts) Bio
Global Moderator |
| Date
| Reply #5 on Mon 28 Nov 2016 10:00 PM (UTC) |
| Message
|
Nick Gammon said:
I can reproduce it with an "at" timer.
Oh, is that what '"at the time" timer' meant. I totally missed that. |
https://github.com/fiendish/aardwolfclientpackage | | Top |
|
| Posted by
| Jcl2016
(8 posts) Bio
|
| Date
| Reply #6 on Tue 29 Nov 2016 04:14 AM (UTC) |
| Message
|
Nick Gammon said:
I can reproduce it with an "at" timer. There is definitely a bug there, introduced when the seconds field became a floating point (so you can have 0.1 seconds).
I suggest as a work-around that you delete and re-add the timer. Or use "addxml.lua" module: http://www.gammon.com.au/forum/?id=7123
Thank you for your suggest, I will try it.
I really want the "at" timers.
An event will occur at a specific time. It's MUD server's time. I need to do something before the event and keep idle for a while. And then I need to do another thing after the specific time, no matter whether the event occurred or not.
For example, I need two "at" timers fire at 10:00:25 and 10:00:35 respectively. Unfortunately, the plugin will run on multiple machines, and the system time of each machine is not the same. So I need SetTimerOption to adjust the fire time dynamically.
As the bug you know, two timers were both be set to 10:00:00 and fired at the same time. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #7 on Sun 11 Dec 2016 09:09 PM (UTC) |
| Message
| | Fixed in version 5.04. |
- 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.
26,980 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top