Welcome to the new Diaspora forums, please let us know if you see anything broken! Notice: Some users may need to reupload their avatars due to an issue during forum setup!
Ship core self destruct timer
This is based on some code I've done before for a timed nuke, as well as some code I've been enhancing for a while. Basically it outputs a formatted string that you can wire to (a) text screen(s). This is a smart string, in that it changes the formatting based on the time, such as adding an hours or even days section. Obviously a day long timer for the self destruct of your ship is overkill, but it can support that long.
You don't HAVE to use a text screen with this. It will constantly print the time in regular intervals, getting shorter and shorter as you near 0. You simply input a number into the "Armed" variable, and it will use that for a time. If you want an instant explosion, just use 1.
Finally, to disarm it I have implemented a fool-proof remote chat operated disarm feature. To disarm the count down, when it is armed you will receive a four digit number which you better keep handy. You type "disarm ####" and it will end the count.
You don't HAVE to use a text screen with this. It will constantly print the time in regular intervals, getting shorter and shorter as you near 0. You simply input a number into the "Armed" variable, and it will use that for a time. If you want an instant explosion, just use 1.
Finally, to disarm it I have implemented a fool-proof remote chat operated disarm feature. To disarm the count down, when it is armed you will receive a four digit number which you better keep handy. You type "disarm ####" and it will end the count.
@name Ship core self destruct
@inputs Armed
@outputs Detonate
@outputs String:string
@outputs [FGColor, BGColor]:vector
@persist Flag Timer Alt Tstart Disarm Aarmed
@trigger Armed
#[
Author: Katelyn Sullivan
Date: May 13, 2011
Contact information
E-mail: Katelyn135@gmail.com
AIM: Consta135
YIM: Katelyn135@ymail.com
MSN: Katelyn135@hotmail.com
]#
if (first())
{
runOnChat(1)
}
if (Armed & Flag == 0) {
Tstart = Armed
Timer = Tstart
Flag = 1
Aarmed = 1
timer("Time", 1000)
Disarm = randint(1000, 9999)
DD = floor((Timer / 86400))
HH = floor((Timer % 86400) / 3600)
MM = floor((Timer % 3600) / 60)
SS = floor((Timer % 3600) % 60)
if (SS:toString():length() == 1)
{
Dss = "0" + SS:toString()
}
else
{
Dss = SS:toString()
}
if (MM:toString():length() == 1)
{
Dmm = "0" + MM:toString()
}
else
{
Dmm = MM:toString()
}
if (HH:toString():length() == 1)
{
Dhh = "0" + HH:toString()
}
else
{
Dhh = HH:toString()
}
if (Timer >= 86400)
{
Out = "Self-destruct in: \n" + DD + ":" + Dhh + ":" + Dmm + ":" + Dss
}
elseif (Timer >= 3600)
{
Out = "Self-destruct in: \n" + HH + ":" + Dmm + ":" + Dss
}
else
{
Out = "Self-destruct in: \n" + Dmm + ":" + Dss
}
print("Nuke Armed for " + Out)
print("Disarm code is: " + Disarm)
}
if (clk("Time") & Aarmed) {
Timer = Timer - 1
timer("Time", 1000)
DD = floor((Timer / 86400))
HH = floor((Timer % 86400) / 3600)
MM = floor((Timer % 3600) / 60)
SS = floor((Timer % 3600) % 60)
if (SS:toString():length() == 1)
{
Dss = "0" + SS:toString()
}
else
{
Dss = SS:toString()
}
if (MM:toString():length() == 1)
{
Dmm = "0" + MM:toString()
}
else
{
Dmm = MM:toString()
}
if (HH:toString():length() == 1)
{
Dhh = "0" + HH:toString()
}
else
{
Dhh = HH:toString()
}
Alt = abs(Alt - 1)
BGColor = vec(52 + (203 * Alt), 52, 52)
FGColor = vec((128 * (1 - (Timer / Tstart))) * abs(Alt - 1), 0, 0)
if (Timer >= 86400)
{
String = String = "Self-destruct in: \n" + DD + ":" + Dhh + ":" + Dmm + ":" + Dss
}
elseif (Timer >= 3600)
{
String = "Self-destruct in: \n" + HH + ":" + Dmm + ":" + Dss
}
else
{
String = "Self-destruct in: \n" + Dmm + ":" + Dss
}
if (Timer > 300 & Timer % 300 == 0)
{
print(String)
}
elseif (Timer <= 300 & Timer % 30 == 0)
{
print(String)
}
elseif (Timer < 30 & Timer % 10 == 0 )
{
print(String:sub(19))
}
elseif (Timer <= 5 & Timer)
{
print(String:sub(19))
}
}
if (Timer == 0 & Aarmed == 1) {
Detonate = 1
String = "Boom"
print("BOOM")
stoptimer("Time")
}
if (chatClk(owner()) & lastSaid():lower():trim() == "disarm " + Disarm) {
stoptimer("Time")
print("Nuke Disarmed")
Flag = 0
Aarmed = 0
String = "D I S A R M E D"
}
Comments
Also, assuming this works, very nice.
Be cool to see a station use this complete with spinning lights and sirens.
I never get personal emails,most of them are mailing list emails from various things i am on.
Mainly because i hate facebook.