Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MonitorSide = "left"
- 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 Bandwidth: ", colours.white, colours.black)
- DrawText(22, 2, (math.random(89, 93) .. " GBit"), colours.lightBlue, colours.black)
- DrawText(2, 4, "Downloaded previous second: ", colours.white, colours.black)
- DrawText(2, 5, (math.random(68, 144) .. " Megabits"), colours.green, colours.black)
- DrawText(2, 7, ("--- Packets " .. string.rep("-", monX - 14)), colours.lightBlue, colours.black)
- DrawText(2, 9, "Packet Buffer Health", colours.white, colours.black)
- ProgressBar(2, 10, monX - 2, math.random(97, 100), 100, colours.grey, colours.cyan)
- DrawText(2, 12, "Packets Lost last second", colours.white, colours.black)
- DrawText(2, 13, (math.random(0, 3) .. " packets"), colours.red, colours.black)
- DrawText(2, 15, string.rep("-", monX - 2), colours.lightBlue, colours.black)
- DrawText(2, 17, "Intrusions Detected: ", colours.white, colours.black)
- DrawText(23, 17, "0", colours.red, colours.black)
- sleep(0.5)
- end
- end
- Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement