Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Date difference to run something

Just Surveryor
Registered User
Join date: 14 Dec 2006
Posts: 31
11-19-2007 10:30
Hi masters!

I m searching a script to do this:

(1)- When the object is rezzed he "read" the actual date.

(2)- First he check if the date is between a pre-programable date like 11/19/2007 to 11/25/2007 - one week;

(3)- If the object is rezzed on the programable interval then he run. If not , the script kill the object via llDie or kill something important like a script.

I start my research here: http://www.lslwiki.net/lslwiki/wakka.php?wakka=time, then here: http://www.lslwiki.net/lslwiki/wakka.php?wakka=LibraryTimestampDifference

:-( I m trying but to me is very hard manipulate dates and time routines.

Any master can help me?
_____________________
------------------------
My system:

AMD Semprom 3000+, 1 GB Kingston memory, NVIDIA 6600 GT, DSL conection (from Brazil), Realtek NIC, LG L1950 H monitor, 2 HD´s SATA 80 GB, Windows XP Pro Service Pack 2.
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
11-19-2007 11:00
If you have to use a fixed window of time, then you can do this:

on_rez:
CurrentTime = llGetUnixTime();
if ((CurrentTime < StartTime) || (CurrentTime > EndTime)) {
llOwnerSay("Not within allowed time window. Deleting self!";);
llDie();
}

Then you just set the StartTime and EndTime to the corresponding Unix timestamps (they are integers) for the exact times you want the object to run within. There are a bunch of websites out there which convert real date/time values to Unix timestamps and back again.

If you are just wanting to make like a demo product, which starts when the object is first rezzed, then you can do something like:

on_rez:
CurrentTime = llGetUnixTime();
if (Started) {
if (CurrentTime > ExpireTime) {
llOwnerSay("Time expired. Deleting self!";);
llDie();
}
} else {
ExpireTime = CurrentTime + ActiveDuration;
Started = TRUE;
}

Started starts off FALSE. ActiveDuration is set to the length of time the object is allowed to work, in seconds. So, if you wanted the object to work for exactly one week, set ActiveDuration to 60 * 60 * 24 * 7.

If the object needs to check while it is rezzed, then you can stick the same check in the timer() event and use llSetTimerEvent(60.0) to check every minute.
Just Surveryor
Registered User
Join date: 14 Dec 2006
Posts: 31
11-19-2007 15:01
From: Talarus Luan

If you are just wanting to make like a demo product, which starts when the object is first rezzed, then you can do something like:


Bingo Talarus. Thank you very much. Really is for a demo product.

If someone need more information when Talarus talk about conversion Unix Time, go to http://www.4webhelp.net/us/timestamp.php

-
_____________________
------------------------
My system:

AMD Semprom 3000+, 1 GB Kingston memory, NVIDIA 6600 GT, DSL conection (from Brazil), Realtek NIC, LG L1950 H monitor, 2 HD´s SATA 80 GB, Windows XP Pro Service Pack 2.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
11-19-2007 20:44
beware, that if the user rezzes the object on no script land, they can delete the scripts from the object, even if the object is no-mod.... (it shouts that you can't modify the object, but still deletes/moves the script to inventory)

this is ok if the script is what makes the object work, but very bad if it's the object itself that's the selling point
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -