This is a very simple script to self-destruct a primitive at a certain date and time which also survives simulator resets. All date and time references are set in UTC time because we do not want to overload the script too much.
In order to set a self-destruct time:
YYYY-MM-DD hh:mm
where the letters stand for:
Symbol | Description |
---|---|
Y | year, as four digits |
M | month, as two digits |
D | day, as two digits |
h | hour, as two digits in 24hour time |
m | minutes |
An example could be:
2012-08-20 13:00
which would make the primitive self-destruct at 1:00 PM
on the 20th of August 2012
.
/////////////////////////////////////////////////////////////////////////// // Copyright (C) Wizardry and Steamworks 2011 - License: GNU GPLv3 // // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // // rights of fair usage, the disclaimer and warranty conditions. // /////////////////////////////////////////////////////////////////////////// string zTimeDate; default { state_entry() { llSensorRepeat("", NULL_KEY, AGENT, .1, .1, 1); } no_sensor() { llSensorRemove(); zTimeDate = llGetObjectDesc(); list cTimeDate = llParseString2List(zTimeDate, [" "], []); // Arm check list nTimeDate = llParseString2List(llGetTimestamp(),["-",":"],["T"]); list nDate = llParseString2List(llList2String(cTimeDate, 0), ["-"], []); list nTime = llParseString2List(llList2String(cTimeDate, 1), [":"], []); if(llGetListLength(nDate) + llGetListLength(nTime) != 5) { llSetText("Time now: " + llList2String(nTimeDate, 0) + "-" + llList2String(nTimeDate, 1) + "-" + llList2String(nTimeDate, 2) + " " + llList2String(nTimeDate, 4) + ":" + llList2String(nTimeDate, 5) + " UTC\nSelf-destruct is not armed.\n", <1,1,1>, 1); llSensorRepeat("", NULL_KEY, AGENT, .1, .1, 1); return; } llSetText("Time now: " + llList2String(nTimeDate, 0) + "-" + llList2String(nTimeDate, 1) + "-" + llList2String(nTimeDate, 2) + " " + llList2String(nTimeDate, 4) + ":" + llList2String(nTimeDate, 5) + " UTC\n" + "Self-Destruct: " + zTimeDate + " UTC", <1,1,1>, 1); llSetTimerEvent(1); } on_rez(integer pin) { llResetScript(); } timer() { if(llGetObjectDesc() != zTimeDate) llResetScript(); list nTimeDate = llParseString2List(llGetTimestamp(),["-",":"],["T"]); list nDate = llParseString2List(zTimeDate, ["-"], []); list nTime = llParseString2List(zTimeDate, [":"], []); if(llGetListLength(nDate) + llGetListLength(nTime) != 5) { llSetText("Time now: " + llList2String(nTimeDate, 0) + "-" + llList2String(nTimeDate, 1) + "-" + llList2String(nTimeDate, 2) + " " + llList2String(nTimeDate, 4) + ":" + llList2String(nTimeDate, 5) + " UTC\nSelf-destruct is not armed.\n", <1,1,1>, 1); llSensorRepeat("", NULL_KEY, AGENT, .1, .1, 1); return; } list cTimeDate = llParseString2List(zTimeDate, [" "], []); llSetText("Time now: " + llList2String(nTimeDate, 0) + "-" + llList2String(nTimeDate, 1) + "-" + llList2String(nTimeDate, 2) + " " + llList2String(nTimeDate, 4) + ":" + llList2String(nTimeDate, 5) + " UTC\n" + "Self-Destruct: " + llGetObjectDesc() + " UTC", <1,1,1>, 1); list zDate = llParseString2List(llList2String(cTimeDate, 0), ["-"], []); if(llList2Integer(zDate, 0) < llList2Integer(nTimeDate, 0)) return; if(llList2Integer(zDate, 1) < llList2Integer(nTimeDate, 1)) return; if(llList2Integer(zDate, 2) < llList2Integer(nTimeDate, 2)) return; list zTime = llParseString2List(llList2String(cTimeDate, 1), [":"], []); if(llList2Integer(zTime, 0) < llList2Integer(nTimeDate, 4)) return; if(llList2Integer(zTime, 1) < llList2Integer(nTimeDate, 5)) return; llDie(); } }