Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Monitor = peripheral.wrap(MonitorSide)
- function ClearMonitor()
- Monitor.setTextColor(colours.black)
- Monitor.setBackgroundColor(colours.black)
- Monitor.clear()
- Monitor.setCursorPos(1,1)
- end
- function DrawText(xPos, yPos, text, textColour, backgroundColour)
- Monitor.setBackgroundColor(backgroundColour)
- Monitor.setTextColor(textColour)
- Monitor.setCursorPos(xPos,yPos)
- Monitor.write(text)
- end
- function DrawLine(x, y, lineLength, colour)
- Monitor.setBackgroundColor(colour)
- Monitor.setTextColor(colour)
- Monitor.setCursorPos(x,y)
- Monitor.write(string.rep(" ", lineLength))
- end
- function ProgressBar(xPos, yPos, barLength, value, maxValue, backgroundColour, progressColour)
- DrawLine(xPos, yPos, barLength, backgroundColour) --backgoround bar
- local barSize = math.floor((value/maxValue) * barLength)
- DrawLine(xPos, yPos, barSize, progressColour) --progress so far
- end
- function Main()
- while true do
- ClearMonitor()
- Monitor.setTextScale(2)
- local monX, monY = Monitor.getSize()
- DrawText(2, 2, "Facility Power: ", colours.white, colours.black)
- DrawText(19, 2, "ONLINE", colours.green, colours.black)
- DrawText(2, 4, "Backup Power Buffer", colours.white, colours.black)
- ProgressBar(2, 5, monX - 2, math.random(88, 99), 100, colours.grey, colours.green)
- DrawText(2, 7, string.rep("-", monX - 2), colours.grey, colours.black)
- DrawText(2, 9, "Facility Voltage: ", colours.white, colours.black)
- DrawText(20, 9, (math.random(49, 50) .. " kV"), colours.orange, colours.black)
- DrawText(2, 11, "Current Draw: ", colours.white, colours.black)
- DrawText(16, 11, (math.random(378, 412) .. " amps"), colours.red, colours.black)
- sleep(0.5)
- end
- end
- Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement