Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.unloadAPI("ProgressBar")
- os.loadAPI("ProgressBar")
- os.unloadAPI("button")
- os.loadAPI("button")
- button.setMon("top")
- function setbuttons()
- button.add("status", "On/Off","toggle",2,4,15,6,colors.red,colors.green,colors.white,function() prepMsg() end)
- button.setState("status",false)
- button.draw()
- end
- rednet.open("bottom")
- ProgressBar.SetPeripheral("top")
- function showColours()
- for i=1,16 do
- writeColAt(2+i,23,i,"H")
- end
- end
- m=peripheral.wrap("top")
- m.setTextScale(1)
- m.setTextColor(5)
- function split(str, delim, maxNb)
- if string.find(str, delim) == nil then
- return { str }
- end
- if maxNb == nil or maxNb <1 then
- maxNb = 0
- end
- local result = {}
- local pat = "(.-)"..delim.."()"
- local nb = 0
- local lastPos
- for part, pos in string.gmatch(str,pat) do
- nb = nb+1
- result[nb]=part
- lastPos=pos
- if nb==maxNb then break end
- end
- if nb ~= maxNb then
- result[nb+1] = string.sub(str,lastPos)
- end
- return result
- end
- function round(val, decimal)
- if (decimal) then
- return math.floor( (val * 10^decimal) + 0.5) / (10^decimal)
- else
- return math.floor(val+0.5)
- end
- end
- function writeAt(x,y,text)
- m.setCursorPos(x,y)
- m.write(text)
- end
- function writeColAt(x,y,colour,text)
- m.setTextColor(colour)
- m.setCursorPos(x,y)
- m.write(text)
- end
- function white()
- m.setTextColor(colors.white)
- end
- function orange()
- m.setTextColor(colors.orange)
- end
- function magenta()
- m.setTextColor(colors.magenta)
- end
- function lightblue()
- m.setTextColor(colors.lightBlue)
- end
- function yellow()
- m.setTextColor(colors.yellow)
- end
- function lime()
- m.setTextColor(colors.lime)
- end
- function pink()
- m.setTextColor(colors.pink)
- end
- function gray()
- m.setTextColor(colors.gray)
- end
- function lightgray()
- m.setTextColor(colors.lightGray)
- end
- function cyan()
- m.setTextColor(colors.cyan)
- end
- function purple()
- m.setTextColor(colors.purple)
- end
- function blue()
- m.setTextColor(colors.blue)
- end
- function brown()
- m.setTextColor(colors.brown)
- end
- function green()
- m.setTextColor(colors.green)
- end
- function red()
- m.setTextColor(colors.red)
- end
- function black()
- m.setTextColor(colors.black)
- end
- while true do
- local time= os.time()
- local fTime = textutils.formatTime(time,false)
- local event, id, msg = os.pullEvent("rednet_message")
- local Tab = split(msg,"|",32)
- local pc = round(Tab[27]*100,0)
- local es = round(Tab[2]/100000,0)
- local fpc = round(Tab[31]*100,0)
- m.clear()
- white()
- writeAt(22,25,fTime)
- blue()
- writeAt(2,1,"Reactor Info")
- white()
- writeAt(2,3,"Status: "..Tab[13])
- writeAt(2,4,"Energy Stored")
- ProgressBar.SetTable("Energy",100,es,20,45,4)
- writeAt(2,5,"Fuel Level: ")
- ProgressBar.SetTable("Fuel",100,fpc,20,45,5)
- writeAt(2,6,"Core Temp: "..round(Tab[16],1).."C")
- writeAt(2,7,"Case Temp: "..round(Tab[19],1).."C")
- writeAt(2,8,"Coolant Type: "..Tab[20])
- writeAt(2,9,"Coolant Level: ")
- ProgressBar.SetTable("Coolant",100,pc,20,45,9)
- writeAt(2,10,"Waste Level: "..Tab[31])
- writeAt(2,12,"Turbine Info")
- writeAt(2,14,"Status: "..Tab[13])
- writeAt(2,15,"Energy Stored "..Tab[2])
- writeAt(2,16,"Rotor Speed: "..round(Tab[3],0).." RPM")
- writeAt(2,17,"Input Type: "..Tab[5])
- writeAt(2,18,"Input Amount: "..Tab[4].." MB")
- writeAt(2,19,"Output Type: "..Tab[7])
- writeAt(2,20,"Output Amount: "..Tab[6].." MB")
- writeAt(2,21,"Coil Status: ")
- red()
- writeAt(20,21,Tab[12])
- white()
- ProgressBar.DrawToPeripheral()
- sleep(1)
- -- ProgressBar.SetCurValue("Test",pc)
- -- ProgressBar.DrawToPeripheral()
- -- sleep(1)
- -- button.check() -- This goes into a wait loop and does not come out again....
- end
Advertisement
Add Comment
Please, Sign In to add comment