Lua timer not firing.

Posted by Zeno on Sat 28 Jul 2007 07:34 PM — 12 posts, 27,470 views.

USA #0
I have this timer:
  <timer enabled="y"    send_to="12"
at_time="y" >
  <send>Note ("Starting new log file.")
CloseLog()
OpenLog ('BIYG-'..os.date("%m")..'-'..os.date("%d")..'-'..os.date("%Y")..'.txt', false)</send>

  </timer>


It is meant to fire at midnight to rotate my logs. The timer seems to never fire though, I tried setting my clock to 11:59PM and watching it hit the time.
Netherlands #1
I may be blind, but where is the time you are triggering on in the <timer> tag?
USA #2
I dunno. It's set to time at 0 hours, 0 min, 0 sec (which I assume is midnight) in the GUI.
Netherlands #3
And is that absolute setting or a relative setting? I can't really test atm.

Otherwise, amuse me and try setting it to 00:01:30 (hh:mm:ss).
USA #4
It's set "At the time: 0 0 0".

Here is what I get for 00:01:30
<timer enabled="y" minute="1" second="30.00"    send_to="12"
at_time="y" >
  <send>Note ("Starting new log file.")
CloseLog()
OpenLog ('BIYG-'..os.date("%m")..'-'..os.date("%d")..'-'..os.date("%Y")..'.txt', false)</send>

  </timer>
Amended on Sat 28 Jul 2007 08:00 PM by Zeno
Netherlands #5
And does that work now?

Otherwise, a far-fetched idea of why it might not be working... I recall Nick changing the way <timer> was parsed for ImportXML due to some bug or unintended behaviour. Maybe this is some kind of regression with normal timers?
USA #6
Didn't seem to work. I set the clock to 11:59PM and let it go to 12:03AM. Nothing happened.
Netherlands #7
Weird. I don't think I can help you anymore then. Sorry. :(
Australia Forum Administrator #8
Quote:

The timer seems to never fire though, I tried setting my clock to 11:59PM and watching it hit the time.


Are you connected to the world at the time? You need to check "Active when Disconnected".
USA #9
I'm always connected to the world.
Australia Forum Administrator #10
I set up your timer, and set the time to 11:59 pm, and it fired at midnight. However to test it I did a:


ResetTimer ("test") -- after renaming the timer "test"


The reason is that if you fiddle with the time it may get confused. Especially if you set the clock back to 11:59 pm it may think it has a day to go (not a minute). So by doing a ResetTimer you are making sure the day/date it is set to fire is the correct one.
Australia Forum Administrator #11
The other thing I would do is print (or note somewhere) the return code from OpenLog. If it fails for some reason, the logs won't open. For example, if the path is not right.