Jump to content

Reset script monthly


Naadirah Jewell
 Share

You are about to reply to a thread that has been inactive for 2155 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

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

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

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

You are about to reply to a thread that has been inactive for 2155 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...