Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- taked from code on this forum post: http://minecraftcomputercraft.wikia.com/wiki/LUA_Vertical_Scroller
- tSides = {"left","right","bottom","top","front","back"}
- for i = 1, #tSides do
- monitor = peripheral.wrap(tSides[i])
- if monitor then
- side = tSides[i]
- break
- end
- end
- term.redirect(peripheral.wrap(side))
- monitor.setTextScale(2)
- term.clear()
- term.setCursorPos(1,1)
- local data = {}
- local breakOut = false
- logo = [[
- Crusty's Goal Board!
- ====================
- ]]
- function clearscreen()
- local _,row=term.getCursorPos()
- local _,height=term.getSize()
- width, height = term.getSize()
- term.setCursorPos(1,1)
- dl = ""
- sl = ""
- for g=1,width do
- dl =dl.."_"
- sl = sl.." "
- end
- for y=1,height do
- term.setCursorPos(1,y)
- print(dl)
- sleep(0.01)
- end
- for y=1,height do
- term.setCursorPos(1,y)
- print(sl)
- sleep(0.01)
- end
- term.clear()
- end
- function printTo()
- local _,row=term.getCursorPos()
- local _,height=term.getSize()
- term.setCursorPos(1,1)
- print(logo)
- term.setCursorPos(1,5)
- row = 8
- for i=1,#data do
- print(data[i])
- sleep(1)
- row=row+1
- if row>height then
- row=height
- term.scroll(1)
- end
- end
- end
- local function readLines(sPath)
- local file = fs.open(sPath, "r")
- local line = file.readLine()
- local lineNum = 0
- while line do
- table.insert(data, line)
- line = file.readLine()
- lineNum = lineNum + 1
- end
- file.close()
- sleep(1)
- end
- function newLine()
- local _,cY= term.getCursorPos()
- term.setCursorPos(1,cY+1)
- end
- function program()
- while true do
- clearscreen()
- printTo()
- sleep(0.5)
- end
- end
- function exitProgram()
- repeat
- local ev, key = os.pullEvent('key')
- until key == 207
- end
- readLines("text.txt")
- parallel.waitForAny(program, exitProgram)
- term.restore()
Advertisement
Add Comment
Please, Sign In to add comment