Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local monitors = {peripheral.find("monitor")}
- local entry = {}
- repeat
- term.setTextColor(colors.white)
- term.clear()
- term.setCursorPos(1,1)
- print("Insert SCP ID")
- scp = read()
- if fs.exists("SCP-" .. scp) == false then
- term.setTextColor(colors.red)
- print("")
- print("File Not Found!")
- sleep(1)
- end
- until fs.exists("SCP-" .. scp)
- local filename = "SCP-" .. scp
- local file = fs.open(filename,"r")
- local length = fs.getSize(filename)
- for curline = 1, length do
- table.insert(entry,file.readLine())
- end
- local scrollMax = #entry - 20
- monitors[1].clear()
- monitors[2].clear()
- monitors[1].setCursorPos(1,1)
- monitors[2].setCursorPos(1,1)
- monitors[1].setTextScale(0.5)
- monitors[2].setTextScale(0.5)
- pos = 0
- local redraw = true
- local max = 27
- function display()
- while true do
- sleep(.05)
- if redraw then
- redraw = false
- -- monitors[1].clear()
- for curm = 1,2 do
- curline2 = 0
- repeat
- -- monitors[curm].clearLine(curline2+1)
- --repeat
- curline2 = curline2 + 1
- monitors[curm].setCursorPos(1, curline2 + 1)
- monitors[curm].clearLine(curline2 + 1)
- monitors[curm].setCursorPos(1,curline2 + 1)
- if entry[curline2 + pos] ~= nil then
- local l = entry[curline2 + pos]
- local c = tonumber(l:sub(#l, #l))
- local cs = {
- [ 1 ] = colors.white,
- [2] = colors.red,
- [3] = colors.green,
- [4] = colors.cyan,
- }
- c = cs[c] or colors.black
- monitors[curm].setTextColor(c)
- l = l:sub(1,#l - 1)
- monitors[curm].write(l)
- else
- write(" ")
- end
- m1x1, m1y1 = monitors[curm].getSize()
- monitors[curm].write((" "):rep(max - m1x1))
- until curline2 == 20
- end
- end
- end
- end
- function control()
- sleep(1)
- while true do
- local _, _2, x, y = os.pullEvent("monitor_touch")
- if y >= m1y1 / 2 then
- if pos <= scrollMax then
- pos = pos + 1
- end
- else
- if pos ~= 0 then
- pos = pos - 1
- end
- end
- redraw = true
- end
- end
- for temp = 1, 2 do
- monitors[temp].setCursorPos(1,1)
- monitors[temp].setTextColor(colors.gray)
- monitors[temp].write("-------------------------------------")
- monitors[temp].setCursorPos(1,22)
- monitors[temp].write("-------------------------------------")
- monitors[temp].setTextColor(colors.white)
- end
- parallel.waitForAll(control,display)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement