Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.wrap("left")
- function lineBreak()
- x, y = mon.getCursorPos()
- if y ~= 1 then
- y = y + 1
- end
- mon.setCursorPos(1, y)
- width, height = mon.getSize()
- mon.write("+" .. string.rep("-", width - 2) .. "+")
- end
- function printString(sString)
- x, y = mon.getCursorPos()
- y = y + 1
- mon.setCursorPos(1, y)
- mon.write(sString)
- end
- function printStringCentre(sString)
- x, y = mon.getCursorPos()
- y = y + 1
- mon.setCursorPos(1, y)
- width, height = mon.getSize()
- nStringCentre = math.floor(string.len(sString) / 2)
- nMonitorCentre = math.floor(width / 2)
- x = math.floor(nMonitorCentre - nStringCentre)
- mon.setCursorPos(x, y)
- mon.write(sString)
- end
- function printStringRight(sString)
- width, height = mon.getSize()
- x, y = mon.getCursorPos()
- y = y + 1
- x = math.ceil(width - string.len(sString))
- mon.setCursorPos(x, y)
- mon.write(sString)
- end
- function scrollText(tStrings, nRate)
- nRate = nRate or 5
- if nRate < 0 then
- error("rate must be positive")
- end
- local nSleep = 1 / nRate
- width, height = mon.getSize()
- x, y = mon.getCursorPos()
- sText = ""
- for n = 1, #tStrings do
- sText = sText .. tostring(tStrings[n])
- sText = sText .. " | "
- end
- sString = "| "
- if width / string.len(sText) < 1 then
- nStringRepeat = 3
- else
- nStringRepeat = math.ceil(width / string.len(sText) * 3)
- end
- for n = 1, nStringRepeat do
- sString = sString .. sText
- end
- while true do
- for n = 1, string.len(sText) do
- sDisplay = string.sub(sString, n, n + width - 1)
- mon.clearLine()
- mon.setCursorPos(1, y)
- mon.write(sDisplay)
- sleep(nSleep)
- end
- end
- end
- mon.clear()
- mon.setCursorPos(1, 1)
- lineBreak()
- printStringCentre("|News Board|")
- lineBreak()
- printString("")
- lineBreak()
- tScrollText = {}
- tScrollText[1] = "BREAKING NEWS"
- tScrollText[2] = "It's not in the way that you hold me It's not in the way you say you care It's not in the way you've been treating my friends It's not in the way that you stayed till the end It's not in the way you look or the things that you say that you'll do Hold the line, love isn't always on time, oh oh oh Hold the line, love isn't always on time, oh oh oh It's not in the words that you told me, girl It's not in the way you say you're mine, ooh It's not in the way that you came back to me It's not in the way that your love set me free It's not in the way you look or the things that you say that you'll do Hold the line, love isn't always on time, oh oh oh Hold the line, love isn't always on time, oh oh oh It's not in the words that you told me It's not in the way you say you're mine, ooh It's not in the way that you came back to me It's not in the way that your love set me free It's not in the way you look or the things that you say that you'll do Hold the line, love isn't always on time, oh oh oh Hold the line, love isn't always on time (Love isn't always on time) Hold the line, love isn't always on time (love isn't always, love isn't always on time) Hold the line, love isn't always on time Love isn't always on time Love isn't always on time Love isn't always on time, oh oh oh"
- x, y = mon.getCursorPos()
- y = y - 1
- mon.setCursorPos(1, y)
- scrollText(tScrollText)
Add Comment
Please, Sign In to add comment