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(xPos, yPos, lineLength, colour)
- Monitor.setBackgroundColor(colour)
- Monitor.setTextColor(colour)
- Monitor.setCursorPos(xPos,yPos)
- 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 GroupBox(xPos, yPos, height, header, textColour, headerBackgroundColour, rightPadding)
- GroupBoxHeader(xPos, yPos, header, textColour, headerBackgroundColour, rightPadding)
- GroupBoxFooter(xPos, yPos + height + 1, textColour, headerBackgroundColour, rightPadding)
- end
- function GroupBoxHeader(xPos, yPos, header, textColour, backgroundColour, rightPadding)
- local repeatChars
- local headerLength = string.len(header)
- local monX, monY = Monitor.getSize()
- repeatChars = monX - 4 - headerLength - rightPadding
- if (repeatChars < 0) then
- repeatChars = 0
- end
- local head = "--- " .. header .. " " .. string.rep("-", repeatChars - rightPadding)
- DrawText(xPos, yPos, head, textColour, backgroundColour)
- end
- function GroupBoxFooter(xPos, yPos, textColour, backgroundColour, rightPadding)
- local repeatChars
- local monX, monY = Monitor.getSize()
- repeatChars = monX - rightPadding
- if (repeatChars < 0) then
- repeatChars = 0
- end
- local head = string.rep("-", repeatChars)
- DrawText(xPos, yPos, head, textColour, backgroundColour)
- end
- function Main()
- while (true) do
- ClearMonitor()
- Monitor.setTextScale(2)
- local monX, monY = Monitor.getSize()
- DrawText(2, 2, "Rocket Engines: ", colours.white, colours.black)
- DrawText(18, 2, "ACTIVE", colours.green, colours.black)
- local thrust = math.random(95, 100)
- local thrustKG = thrust * 1800
- DrawText(2, 4, "Rocket Thrust: ", colours.white, colours.black)
- DrawText(17, 4, thrust .. "%", colours.green, colours.black)
- DrawText(2, 5, "Rocket Force", colours.white, colours.black)
- DrawText(17, 5, thrustKG .. " KG", colours.orange, colours.black)
- ProgressBar(2, 6, monX - 2, thrust, 100, colours.grey, colours.green)
- sleep(1)
- end
- end
- Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement