Posted 19 July 2013 - 02:05 PM
So, about a month ago I built in FTB a replica of the Swan Station from LOST and here is the programm I created :)/> .
For those that don't know. This timer counts down 108 minutes and if no redstone signal is applied within the given time to the right of the computer, it shows some glyphs and emmits a redstone signal from bundled redpower wire. When the timer reaches 4 minutes the seconds timer start counting down too (only then, that's what happened in the series so I designed it this way) and an iron note block peripheral emmits the "BEEP" noise. When the timer if below a minute, an industrial craft 2 howler alarm goes off by the redpower bundled cables.
NOTE: Remember to use 3 advanced monitors and an advanced computer.
Alter the code to your preferences. Sorry that I did not put comments on the code :(/> .
Here is a pic of the the timer:
And here's the code:
For those that don't know. This timer counts down 108 minutes and if no redstone signal is applied within the given time to the right of the computer, it shows some glyphs and emmits a redstone signal from bundled redpower wire. When the timer reaches 4 minutes the seconds timer start counting down too (only then, that's what happened in the series so I designed it this way) and an iron note block peripheral emmits the "BEEP" noise. When the timer if below a minute, an industrial craft 2 howler alarm goes off by the redpower bundled cables.
NOTE: Remember to use 3 advanced monitors and an advanced computer.
Alter the code to your preferences. Sorry that I did not put comments on the code :(/> .
Here is a pic of the the timer:
And here's the code:
--Swan Station Timer
term.clear()
term.setCursorPos(1,1)
m = peripheral.wrap("front")
s = peripheral.wrap("top")
m.setTextScale(5)
minutes = 108
seconds = 0
print("Initializing Timer...")
m.clear()
m.setCursorPos(1,1)
m.setTextColor(1)
m.setBackgroundColor(32768)
m.write("108:")
m.setTextColor(32768)
m.setBackgroundColor(1)
m.write("00")
while(minutes >0 or seconds > 0) do
if (redstone.getInput("right") and minutes < 4) then
redstone.setBundledOutput("left", 0)
print("Reseting...")
minutes = 108
seconds = 0
print("Initializing timer...")
m.clear()
m.setCursorPos(1,1)
m.setTextColor(1)
m.setBackgroundColor(32768)
m.write("108:")
m.setTextColor(32768)
m.setBackgroundColor(1)
m.write("00")
os.sleep(1)
end
m.setCursorPos(1,1)
temp = seconds
temp2 = minutes
if (minutes == 0 and seconds == 0 ) then
seconds = 0
temp = seconds
end
if(minutes <= 4) then
if (minutes <= 4 and minutes >=1) then
s.playNote(0,18)
end
if (minutes < 1) then
redstone.setBundledOutput("left", 1)
end
seconds = seconds - 1
temp = seconds
if(seconds < 0) then
seconds = 59
temp = seconds
minutes = minutes - 1
temp2 = minutes
seconds = tostring(seconds)
elseif(seconds < 10 and seconds >= 0) then
seconds = "0"..tostring(seconds)
end
os.startTimer(1)
os.pullEvent("timer")
else
os.startTimer(60)
os.pullEvent("timer")
minutes = minutes - 1
temp2 = minutes
seconds = "0"..tostring(seconds)
end
if (minutes < 10 and minutes >= 0) then
minutes = "00"..tostring(minutes)
elseif (minutes < 100) then
minutes = "0"..tostring(minutes)
end
m.setTextColor(1)
m.setBackgroundColor(32768)
m.write(minutes..":")
m.setTextColor(32768)
m.setBackgroundColor(1)
m.write(seconds)
seconds = tonumber(temp)
minutes = tonumber(temp2)
end
m.clear()
m.setCursorPos(1,1)
m.setTextColor(1)
m.setBackgroundColor(32768)
m.write("000:")
m.setTextColor(32768)
m.setBackgroundColor(1)
m.write("00")
os.sleep(0.5)
m.clear()
m.setBackgroundColor(32768)
m.setTextColor(16384)
m.setCursorPos(1,1)
m.write("l@!:")
m.setBackgroundColor(16384)
m.setTextColor(32768)
m.write("&\\ ")
print("SYSTEM FAILTURE")
os.startTimer(5)
os.pullEvent("timer")
redstone.setBundledOutput("left", 2)
while true do
if (redstone.getInput("right")) then
os.sleep(1)
os.reboot()
end
os.pullEvent("redstone")
end