Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- box1 = peripheral.wrap("tile_thermalexpansion_cell_basic_name_12")
- box2 = peripheral.wrap("tile_thermalexpansion_cell_basic_name_11")
- box3 = peripheral.wrap("tile_thermalexpansion_cell_basic_name_10")
- monitor = peripheral.wrap("monitor_116")
- function round(a,b)
- local m = 10^(b or 0)
- return math.floor(a * m + 0.5) / m
- end
- function maxStored(box)
- return box.getMaxEnergyStored()
- end
- function stored(box)
- return box.getEnergyStored()
- end
- function percentage(box)
- return round((stored(box) * 100) / maxStored(box), 2)
- end
- function start()
- print("Running energy system")
- monitor.write("Loading...")
- while true do
- monitor.clear()
- monitor.setCursorPos(1,1)
- monitor.write("Energy stored in the energy cells")
- monitor.setCursorPos(1,2)
- monitor.write("----------------------")
- monitor.setCursorPos(1,3)
- monitor.write("Box 1: "..stored(box1).."/"..maxStored(box1).." - "..percentage(box1).."%")
- monitor.setCursorPos(1,4)
- monitor.write("Box 2: "..stored(box2).."/"..maxStored(box2).." - "..percentage(box2).."%")
- monitor.setCursorPos(1,5)
- monitor.write("Box 3: "..stored(box3).."/"..maxStored(box3).." - "..percentage(box3).."%")
- sleep(2.5)
- end
- end
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement