Posted 21 April 2014 - 10:36 PM
Hello everyone.
I wrote some code that shows information on a monitor about the reactor.
The information works but is it possible to improve the response time?
Now the information updates every second because of the os.reboot command.
Is it also possible if the computer gets a redstone pulse that it updates the status about it?
The code I have so far:
I wrote some code that shows information on a monitor about the reactor.
The information works but is it possible to improve the response time?
Now the information updates every second because of the os.reboot command.
Is it also possible if the computer gets a redstone pulse that it updates the status about it?
The code I have so far:
mon = peripheral.wrap("left")
local x = rs.testBundledInput("right", colors.white)
while x ~= banana do
white = rs.testBundledInput("right", colors.white) -- Reactor Status 1208
orange = rs.testBundledInput("right", colors.orange) -- uranium inser 1201
black = rs.testBundledInput("right", colors.black) -- Coolant Insert 1200
red = rs.testBundledInput("right", colors.red) -- Alarm 1 alarm File
-- Chest Checks
cchest = rs.testBundledInput("back", colors. blue) -- Coolant Chest Status 1300
uchest = rs.testBundledInput("back", colors. red) -- Uranium Chest Status 1301
-- == REACTOR STATUS
if white == true then
mon.setTextColor(colors.white)
mon.setBackgroundColor(colors.black)
mon.setCursorPos(1,1)
mon.write("Reactor 1:")
mon.setCursorPos(18,1)
mon.setTextColor(colors.lime)
mon.setBackgroundColor(colors.black)
mon.write("ONLINE ")
else
mon.setTextColor(colors.white)
mon.setBackgroundColor(colors.black)
mon.setCursorPos(1,1)
mon.write("Reactor 1:")
mon.setCursorPos(18,1)
mon.setTextColor(colors.red)
mon.setBackgroundColor(colors.black)
mon.write("OFFLINE")
end
-- == Coolant STATUS
if white == false then
mon.setTextColor(colors.white)
mon.setBackgroundColor(colors.black)
mon.setCursorPos(1,2)
mon.write("Coolant Feed:")
mon.setCursorPos(18,2)
mon.setTextColor(colors.red)
mon.setBackgroundColor(colors.black)
mon.write("OFFLINE ")
else
if black == true then
mon.setTextColor(colors.white)
mon.setBackgroundColor(colors.black)
mon.setCursorPos(1,2)
mon.write("Coolant Feed:")
mon.setCursorPos(18,2)
mon.setTextColor(colors.lime)
mon.setBackgroundColor(colors.black)
mon.write("ACTIVE ")
else
mon.setTextColor(colors.white)
mon.setBackgroundColor(colors.black)
mon.setCursorPos(1,2)
mon.write("Coolant Feed:")
mon.setCursorPos(18,2)
mon.setTextColor(colors.orange)
mon.setBackgroundColor(colors.black)
mon.write("IDLE ")
end
-- == Uranium STATUS
if white == false then
mon.setTextColor(colors.white)
mon.setBackgroundColor(colors.black)
mon.setCursorPos(1,3)
mon.write("Uranium Feed:")
mon.setCursorPos(18,3)
mon.setTextColor(colors.red)
mon.setBackgroundColor(colors.black)
mon.write("OFFLINE ")
else
if orange == true then
mon.setTextColor(colors.white)
mon.setBackgroundColor(colors.black)
mon.setCursorPos(1,3)
mon.write("Uranium Feed:")
mon.setCursorPos(18,3)
mon.setTextColor(colors.lime)
mon.setBackgroundColor(colors.black)
mon.write("ACTIVE ")
else
mon.setTextColor(colors.white)
mon.setBackgroundColor(colors.black)
mon.setCursorPos(1,3)
mon.write("Uranium Feed:")
mon.setCursorPos(18,3)
mon.setTextColor(colors.orange)
mon.setBackgroundColor(colors.black)
mon.write("IDLE ")
end
-- == Coolant Chest Status
if white == false then
mon.setTextColor(colors.white)
mon.setBackgroundColor(colors.black)
mon.setCursorPos(1,5)
mon.write("Coolant Storage:")
mon.setCursorPos(18,5)
mon.setTextColor(colors.red)
mon.setBackgroundColor(colors.black)
mon.write("OFFLINE ")
else
if cchest == true then
mon.setTextColor(colors.white)
mon.setBackgroundColor(colors.black)
mon.setCursorPos(1,5)
mon.write("Coolant Storage:")
mon.setCursorPos(18,5)
mon.setTextColor(colors.red)
mon.setBackgroundColor(colors.black)
mon.write("DEPLETED ")
else
mon.setTextColor(colors.white)
mon.setBackgroundColor(colors.black)
mon.setCursorPos(1,5)
mon.write("Coolant Storage:")
mon.setCursorPos(18,5)
mon.setTextColor(colors.orange)
mon.setBackgroundColor(colors.black)
mon.write("Feeding ")
end
-- == Uranium Chest Status
if white == false then
mon.setTextColor(colors.white)
mon.setBackgroundColor(colors.black)
mon.setCursorPos(1,6)
mon.write("Uranium Storage:")
mon.setCursorPos(18,6)
mon.setTextColor(colors.red)
mon.setBackgroundColor(colors.black)
mon.write("OFFLINE ")
else
if uchest == true then
mon.setTextColor(colors.white)
mon.setBackgroundColor(colors.black)
mon.setCursorPos(1,6)
mon.write("Uranium Storage:")
mon.setCursorPos(18,6)
mon.setTextColor(colors.red)
mon.setBackgroundColor(colors.black)
mon.write("DEPLETED ")
else
mon.setTextColor(colors.white)
mon.setBackgroundColor(colors.black)
mon.setCursorPos(1,6)
mon.write("Uranium Storage:")
mon.setCursorPos(18,6)
mon.setTextColor(colors.orange)
mon.setBackgroundColor(colors.black)
mon.write("Feeding ")
end
-- == MELTDOWN STATUS
if red == false then
mon.setTextColor(colors.white)
mon.setBackgroundColor(colors.black)
mon.setCursorPos(1,12)
mon.write("Reactor Temp:")
mon.setCursorPos(18,12)
mon.setTextColor(colors.lime)
mon.setBackgroundColor(colors.black)
mon.write("SAFE ")
else
shell.run("alarm")
end
os.sleep(1)
end
Edited on 21 April 2014 - 08:37 PM