Naadirah Jewell Posted November 1, 2016 Share Posted November 1, 2016 We use a really simple tip jar for our group of entertainers, but we would like it to reset at midnight or 12:01 a.m. on the 1st day of each month, instead of having to do it manually. Is this possible? Is there an example anyone could point me towards? Date stuff on the Wiki didn't seem to help me much. Thank you! Link to comment Share on other sites More sharing options...
Rolig Loon Posted November 1, 2016 Share Posted November 1, 2016 Very simple, at least in bare bones. The LSL function llGetDateAndTime() will provide the current date in the UTC ("Greenwich" time zone) in the form YYYY-MM-DD. Write a short script with a timer that checks that function periodically. For most of the month, it's good enough to just check once a day. Once you get to the 27th day, though, start checking more frequently. When the "DD" indicator suddenly says "01", it's just past midnight on the first day of the month. Use llResetOtherScript() to reset the script for your tip jar in the same object. The only mild trick is that unless you want to do your reset relative to UTC, you'll need to adjust the time for your local time zone.That's easy, though, if you are west of the UK, since your midnight comes several hours later than UTC's. So, watch for when the "DD" indicator flips to "01" and then tell your timer to reset the tip jar X hours later. Link to comment Share on other sites More sharing options...
Naadirah Jewell Posted November 1, 2016 Author Share Posted November 1, 2016 Thank you Rolig for all of that info. I don't understand how to do all that, but I"ll see if I can find someone that does. I guess no matter what we have to check the date daily? Link to comment Share on other sites More sharing options...
Rolig Loon Posted November 1, 2016 Share Posted November 1, 2016 You don't have to check it personally. Just script your timer to do that. For most of the month, just tell your timer to trigger once every 86400 seconds (once a day) and check the date. When the date says that you're near the end of the month -- I said the 27th, because of February -- then tell it to check more often. If you aren't wedded to having the script restart at precisely 12:01, you can tell the timer to trigger every 3600 seconds (once an hour), maybe. If it doesn't really matter whether it's 12:01 UTC or 12:01 local time, you can forget the time zone adjustment. If you can't write something like that yourself, just post in the InWorld Employment forum to attract a hungry scripter. It is an easy enough challenge that you should get a response quickly. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now