Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local wmod = peripheral.wrap("top")
- local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
- wmod.closeAll()
- wmod.open(1)
- local function centerText(text)
- x,y = term.getSize()
- x1,y1 = term.getCursorPos()
- term.setCursorPos((math.floor(x/2) - (math.floor(#text/2))), y1)
- print(text)
- end
- function drawbar()
- bar = math.floor(((message["cur"]/message["maxe"]))*(x-2)+0.4)
- --Draw BackGround Bar
- term.setCursorPos(2,y-4)
- term.setBackgroundColor(colors.white)
- print(string.rep(" ",x-2))
- -- Draw Percent Bar
- term.setCursorPos(2,y-4)
- term.setBackgroundColor(colors.red)
- print(string.rep(" ",bar))
- end
- while redstone.testBundledInput("front", colors.blue) == true do
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.clear()
- centerText("Matrix Energy :")
- term.setCursorPos(1,3)
- print("Percentage: "..message["per"])
- term.setCursorPos(1,4)
- print("Current Energy: "..message["scur"])
- drawbar()
- sleep(1)
- end
- if redstone.testBundledInput("front", colors.blue) == false then
- term.setBackgroundColor(colors.black)
- term.clear()
- os.reboot()
- end
Advertisement
Add Comment
Please, Sign In to add comment