Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local title = "XtreamTech News and Messages"
- local news = {
- "Builds that really lag the server have the risk of being destroyed by staff"
- , "An excessive amount of power flowers is frowned upon, because of server lag"
- }
- function main()
- term.clear()
- local monitor, _, side, width, height, i, padding, item, firstLine, x, y
- firstLine = 2
- for _, side in pairs(rs.getSides()) do
- if peripheral.isPresent(side) then
- if peripheral.getType(side) == "monitor" then
- monitor = peripheral.wrap(side)
- end
- end
- end
- if monitor == nil then
- print("Please attach a monitor to any side")
- return
- end
- width, height = monitor.getSize()
- monitor.clear()
- monitor.setCursorPos(1, firstLine)
- for i = 1, width do
- monitor.write("=")
- end
- padding = (width / 2) - (#title / 2)
- monitor.setCursorPos(1, firstLine + 2)
- for i = 1, padding do
- monitor.write(" ")
- end
- monitor.write(title)
- monitor.setCursorPos(1, firstLine + 4)
- for i = 1, width do
- monitor.write("=")
- end
- for _, item in pairs(news) do
- monitor.setCursorPos(1, firstLine + 6 + _)
- monitor.write("")
- x, y = monitor.getCursorPos()
- monitor.setCursorPos(1, y + 2)
- if _ < 10 then
- monitor.write(" ")
- end
- monitor.write(" " .. _ .. ". " .. item)
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement