Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. local tText = {
  2. "First Line",
  3. "Second Line",
  4. "All the lines you want",
  5. "If they fit on the monitor"
  6. }
  7. -- The side the monitor is on
  8. local sSide = "back"
  9. -- The text scale
  10. local nTextScale = 3
  11.  
  12. local function printScroll(mon, t)
  13. local w, h = mon.getSize()
  14. local scroll = 1
  15. local maxLen
  16. for i, line in ipairs(t) do
  17. if not maxLen or #line > maxLen then
  18. maxLen = #line
  19. end
  20. end
  21. while true do
  22. mon.clear()
  23. for i, line in ipairs(t) do
  24. mon.setCursorPos(w - scroll, i)
  25. mon.write(line)
  26. end
  27. scroll = scroll + 1
  28. if scroll >= w + maxLen then
  29. scroll = 1
  30. end
  31. sleep(0.15)
  32. end
  33. end
  34.  
  35. term.clear()
  36. term.setCursorPos(1, 1)
  37. print("Scrolling text on the monitor...")
  38.  
  39. local mon = peripheral.wrap(sSide)
  40. mon.setTextScale(nTextScale)
  41. printScroll(mon, tText, sx)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement