Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Beef's Matrix Monitor--
- m = peripheral.find("monitor")
- im = peripheral.find("Induction Matrix")
- m.clear()
- --Setting Universal Variables--
- monX, monY = m.getSize()
- local mult = 10^2
- local center = math.floor(monX/2)
- --Core Program Loop--
- while (true)
- do
- --get power levels--
- maxPow = im.getMaxEnergy()
- curPow = im.getEnergy()
- curIn = im.getInput()
- curOut = im.getOutput()
- tfCap = im.getTransferCap()
- charge = math.floor(curPow / maxPow * 100 + 0.5)
- tUse = math.floor((curIn+curOut)/tfCap * 100 + 0.5)
- --Draw Labels--
- m.clear()
- m.setTextScale(.9)
- m.setBackgroundColor(colors.black)
- m.setTextColor(colors.orange)
- m.setCursorPos(center-7,6)
- m.write("Induction Matrix")
- m.setCursorPos(center-43,11)
- m.write("Max Power")
- m.setCursorPos(center-45,15)
- m.write("Current Power")
- m.setCursorPos(center-41,19)
- m.write("Input")
- m.setCursorPos(center-41,23)
- m.write("Output")
- m.setCursorPos(center-44,27)
- m.write("Transfer Cap")
- m.setBackgroundColor(colors.orange)
- m.setCursorPos(2,2)
- m.write(string.rep(" ", (monX)-2))
- m.setCursorPos(2,37)
- m.write(string.rep(" ", (monX)-2))
- m.setBackgroundColor(colors.black)
- --Write Max Power--
- m.setTextColor(colors.white)
- m.setCursorPos(center-42, 13)
- e = im.getMaxEnergy()
- if e >= 1000 and e < 1000000 then
- m.write(string.format("%.0f", math.floor(e/1000 * mult + 0.5)/mult))
- m.write("kRF")
- elseif e >= 1000000 and e < 1000000000 then
- m.write(string.format("%.0f", math.floor(e/1000000 * mult + 0.5)/mult))
- m.write("mRF")
- elseif e >= 1000000000 and e < 1000000000000 then
- m.write(string.format("%.0f", math.floor(e/1000000000 * mult + 0.5)/mult))
- m.write("gRF")
- else
- m.write(tostring(im.maxPow))
- m.write("RF")
- end
- -- Write Current Power--
- m.setCursorPos(center-42, 17)
- e = im.getEnergy()
- if e >= 1000 and e < 1000000 then
- m.write(string.format("%.0f", math.floor(e/1000 * mult + 0.5)/mult))
- m.write("kRF")
- elseif e >= 1000000 and e < 1000000000 then
- m.write(string.format("%.0f", math.floor(e/1000000 * mult + 0.5)/mult))
- m.write("mRF")
- elseif e >= 1000000000 and e < 1000000000000 then
- m.write(string.format("%.0f", math.floor(e/1000000000 * mult + 0.5)/mult))
- m.write("gRF")
- else
- m.write(tostring(curPow))
- m.write("RF")
- end
- --Write Input RF--
- m.setCursorPos(center-42, 21)
- InputOut = 0
- e = im.getInput()
- if e >= 1000 and e < 1000000 then
- m.write(tostring(math.floor(e/1000 * mult + 0.5)/mult))
- m.write("kRF/t")
- elseif e >= 1000000 and e < 1000000000 then
- m.write(tostring(math.floor(e/1000000 * mult + 0.5)/mult))
- m.write("mRF/t")
- elseif e >= 1000000000 and e < 1000000000000 then
- m.write(tostring(math.floor(e/1000000000 * mult + 0.5)/mult))
- m.write("gRF/t")
- elseif e == 0 then
- m.setCursorPos(10,21)
- m.write("0RF/t")
- else
- m.write(tostring(curIn))
- m.write("RF/t")
- end
- --Write Output RF--
- m.setCursorPos(center-42, 25)
- e = im.getOutput()
- if e >= 1000 and e < 1000000 then
- m.write(tostring(math.floor(e/1000 * mult + 0.5)/mult))
- m.write("kRF/t")
- elseif e >= 1000000 and e < 1000000000 then
- m.write(tostring(math.floor(e/1000000 * mult + 0.5)/mult))
- m.write("mRF/t")
- elseif e >= 1000000000 and e < 1000000000000 then
- m.write(tostring(math.floor(e/1000000000 * mult + 0.5)/mult))
- m.write("gRF/t")
- elseif e == 0 then
- m.setCursorPos(10,25)
- m.write("0RF/t")
- else
- m.write(tostring(curOut))
- m.write("RF/t")
- end
- --Write Transfer Cap--
- m.setTextColor(colors.white)
- InputOut = 0
- m.setCursorPos(center-42, 29)
- e = im.getTransferCap()
- if e >= 1000 and e < 1000000 then
- m.write(string.format("%.0f", math.floor(e/1000 * mult + 0.5)/mult))
- m.write("kRF")
- elseif e >= 1000000 and e < 1000000000 then
- m.write(string.format("%.0f", math.floor(e/1000000 * mult + 0.5)/mult))
- m.write("mRF")
- elseif e >= 1000000000 and e < 1000000000000 then
- m.write(string.format("%.0f", math.floor(e/1000000000 * mult + 0.5)/mult))
- m.write("gRF")
- else
- m.write(tostring(tfCap))
- m.write("RF")
- end
- --Draw Power Bar--
- powBar = math.floor((curPow/maxPow)*(monX/2)+0.5)
- m.setBackgroundColor(colors.orange)
- m.setCursorPos(31,13)
- m.write(string.rep(" ",(monX/2)+2))
- m.setCursorPos(31,14)
- m.write(string.rep(" ",(monX/2)+2))
- m.setCursorPos(31,15)
- m.write(string.rep(" ",(monX/2)+2))
- m.setCursorPos(31,16)
- m.write(string.rep(" ",(monX/2)+2))
- m.setCursorPos(31,17)
- m.write(string.rep(" ",(monX/2)+2))
- m.setBackgroundColor(colors.purple)
- m.setCursorPos(32,14)
- m.write(string.rep(" ",(monX/2)))
- m.setCursorPos(32,15)
- m.write(string.rep(" ",(monX/2)))
- m.setCursorPos(32,16)
- m.write(string.rep(" ",(monX/2)))
- m.setBackgroundColor(colors.lime)
- m.setCursorPos(32,14)
- m.write(string.rep(" ", powBar))
- m.setCursorPos(32,15)
- m.write(string.rep(" ", powBar))
- m.setCursorPos(32,16)
- m.write(string.rep(" ", powBar))
- m.setBackgroundColor(colors.black)
- --Write Power Bar Text--
- m.setCursorPos(31,11)
- m.write("Charge: "..charge.."%")
- --Write Transfer Cap Bar--
- tBar = math.floor(((curIn+curOut)/tfCap)*(monX/2)+0.5)
- m.setBackgroundColor(colors.orange)
- m.setCursorPos(31,24)
- m.write(string.rep(" ",(monX/2)+2))
- m.setCursorPos(31,25)
- m.write(string.rep(" ",(monX/2)+2))
- m.setCursorPos(31,26)
- m.write(string.rep(" ",(monX/2)+2))
- m.setCursorPos(31,27)
- m.write(string.rep(" ",(monX/2)+2))
- m.setCursorPos(31,28)
- m.write(string.rep(" ",(monX/2)+2))
- m.setBackgroundColor(colors.cyan)
- m.setCursorPos(32,25)
- m.write(string.rep(" ",(monX/2)))
- m.setCursorPos(32,26)
- m.write(string.rep(" ",(monX/2)))
- m.setCursorPos(32,27)
- m.write(string.rep(" ",(monX/2)))
- m.setBackgroundColor(colors.red)
- m.setCursorPos(32,25)
- m.write(string.rep(" ", tBar))
- m.setCursorPos(32,26)
- m.write(string.rep(" ", tBar))
- m.setCursorPos(32,27)
- m.write(string.rep(" ", tBar))
- m.setBackgroundColor(colors.black)
- --Write Transfer Bar Text--
- m.setCursorPos(31,22)
- m.write("Transfer Usage: "..tUse.."%")
- sleep(.25)
- end
Advertisement
Add Comment
Please, Sign In to add comment