Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Detect the 1st of the month?

Yamil Dagger
Registered User
Join date: 10 Jul 2007
Posts: 36
02-04-2008 15:51
Hi, I have a profit tracker that I use for my mall right now. It keeps track of the rent money paid to me, and also the camp spot money paid FROM me. I was just wondering if there is a lsl command to check what day it is and automatically send 50% to my partner on the 1st of every month. I'd also need a way for it to remember it's already paid and to wait for the next...ect

Is that even possible? I know lsl pretty good so I just need that little piece of code if anybody can provide it...
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
02-04-2008 17:11
You could use llGetDate()

Look at the example script here to see how to parse out just the day. Then you could just set a timer even with a duration of 24 hours and check once a day if the day is 01.

http://www.cheesefactory.us/lslwm/llGetDate.htm
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
02-04-2008 17:24
If you are truly worried about anything possibly going wrong then just set up a an alt and feed it enough money to cover just the payment to your partner.

I was originally going to reply that there would be a remote chance that the script could be reset on the 1st after making a payment and make an extra payment. But I was wrong, even if it was, the timer would be set and still wouldn't check until 24 hours later, which would be the 2nd.

So the very worst that could go wrong in case of a script reset is if it happened on the 1st and before the timer had tripped and made the payment. Then you would either notice that you had not recieved confirmation the payment had been made. Or your inbox is full of nasty messages from your partner a few days later:)
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
02-04-2008 17:34
Just remember that llGetDate() returns the UTC date, which isn't QUITE the same as the SL local (PST or PDT) date. It probably doesn't matter in this case, but it is worth remembering. See http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetDate
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
02-04-2008 18:03
From: Hewee Zetkin
Just remember that llGetDate() returns the UTC date, which isn't QUITE the same as the SL local (PST or PDT) date. It probably doesn't matter in this case, but it is worth remembering. See http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetDate


An easy way to do it is if you want to pay at 7AM on the 1st. Then you just start the script running at that time. It will check at 7 AM local time everyday. (Just depending on where you live, may want to check if at 7AM, the date is the same UTC) and adjust the day below accordingly)

CODE
default {
state_entry() {
llSetTimerEvent((24 * 60 * 60));
}
timer() {
string day = llGetSubString(llGetDate(), 8, 9);
if (day == "01") {
llOwnerSay("It's the first!");
}
}
}
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum