I would look into the Nuclear Information Reader since you are in ultimate pack. You would do something like this:
nir = peripheral.wrap("left") --Side of Nuclear Info Reader
mon = peripheral.wrap("top") --Side of Monitor
nirInfo = nir.get(1)
function resetScreen(bgColor,txtColor)
term.clear()
term.setCursorPos(1,1)
term.setBackgroundColor(bgColor)
term.setTextColor(txtColor)
end
for system,status in pairs(nirInfo) do
status = tostring(status)
print("System: "..system.." Status: "..status)
end
The only command a Nuclear Info Reader can do is nir.get(arg) which returns a table that you have to extract with a for loop. Basically you will want to have a while true loop with a constant nir.get() then a couple of functions that will broadcast that table's info if you are using a red net system. I have an example that isn't quite working, but the idea is there. I just messed up on the button part. Here is the code I put together:
Spoiler
monitor = peripheral.wrap("top")
monitor.clear()
nir = peripheral.wrap("left")
local nuke = paintutils.loadImage("nuke")
os.loadAPI("disk/buttons")
addButton("NuclearReactorToggle",no,reactorToggle,colors.yellow,colors.yellow,colors.black,1,1,25,1)
function reactorToggle()
rednet.open("bottom")
if reactorNumb == 1 then
rednet.send(255,on)
elseif reactorNumb == 2 then
rednet.send(254,on)
elseif reactorNumb == 3 then
rednet.send(254,on)
elseif reactorNumb == 4 then
rednet.send(253,on)
end
end
--System Functions
function heat()
for system,status in pairs(info) do
status = tostring(status)
max = 500
if system == "heat" then
monitor.setCursorPos(1,3)
monitor.setTextColor(colors.yellow)
print("*")
monitor.setCursorPos(1,5)
print("*")
monitor.setTextColor(colors.white)
monitor.setCursorPos(2,3)
print(" Reactor Heat Level = "..status)
monitor.setCursorPos(2,5)
print(" Reactor Max Heat = "..max)
monitor.setTextColor(colors.yellow)
monitor.setCursorPos(27,5)
print("+")
monitor.setTextColor(colors.white)
monitor.setCursorPos(28,5)
print(" or ")
monitor.setCursorPos(33,5)
monitor.setTextColor(colors.yellow)
print("-")
end
end
end
function reactorPower()
for system,status in pairs(info) do
status = tostring(status)
if system == "reactorPoweredB" then
monitor.setBackgroundColor(colors.yellow)
monitor.setTextColor(colors.black)
monitor.setCursorPos(1,1)
for name,data in pairs(disk/buttons) do
local on = data["active"]
if on == true then
reactorStatus = "on"
else
reactorStatus = "off"
end
end
print("Nuclear Reactor #"..reactorNumb.." = "..reactorStatus)
monitor.setCursorPos(1,18)
print("Back")
monitor.setCursorPos(28,18)
print("Page Forward")
monitor.setBackgroundColor(colors.black)
end
end
end
function output()
for system,status in pairs(info) do
status = tostring(status)
if system == "output" then
monitor.setTextColor(colors.yellow)
monitor.setCursorPos(1,7)
print("*")
monitor.setTextColor(colors.white)
monitor.setCursorPos(2,7)
print(" EU Output = "..status)
end
end
end
function timeLeft()
for system,status in pairs(info) do
status = tostring(status)
if system == "timeLeft" then
monitor.setTextColor(colors.yellow)
monitor.setCursorPos(1,9)
print("*")
monitor.setTextColor(colors.white)
monitor.setCursorPos(2,9)
print(" Uranium Cells level = "..status)
end
end
end
function nuclear(numbNuke)
noth1, noth2, card, info = nir.get(numbNuke)
reactorNumb = numbNuke
term.redirect(monitor)
monitor.clear()
monitor.setBackgroundColor(colors.black)
heat()
reactorPower()
output()
timeLeft()
term.restore()
end
--Load Screen Function
local function loadScreen()
monitor.clear()
term.redirect(monitor)
monitor.setTextColor(colors.white)
monitor.setBackgroundColor(colors.black)
monitor.setCursorPos(9,1)
textutils.slowWrite("Nuclear Reactor Controls")
paintutils.drawImage(nuke,-4,2)
monitor.setCursorPos(1,15)
textutils.slowWrite("(Right Click Screen to go edit Reactor)")
while os.pullEvent("monitor_touch") == false do
sleep(0)
end
monitor.clear()
term.restore()
end
--Load Screen Function
loadScreen()
--Nuclear #1 Display/Controls
nuclear(1)
while true do
nuclear(1)
buttonLoop()
sleep(0)
end
PS I used a button api for this. If you want the code just go to my profile and click content, and there are the pastebins.
This is my example of using a nuclear info reader peripheral. I know it isn't timed out, but I'm sure someone could expand on my idea.