Advertisement
TriHard

Untitled

Feb 23rd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. -- The text to show on the monitor
  2. local tText = {
  3. "FOOD STAMPS ACCEPTED CIGS AND MALT LIQUOR OUT OF STOCK SPRITE CRANBERRY ONLY"
  4. }
  5. -- The side the monitor is on
  6. local sSide = "right"
  7. -- The text scale
  8. local nTextScale = 5
  9.  
  10. local function printScroll(mon, t)
  11. local w, h = mon.getSize()
  12. local scroll = 1
  13. local maxLen
  14. for i, line in ipairs(t) do
  15. if not maxLen or #line > maxLen then
  16. maxLen = #line
  17. end
  18. end
  19. while true do
  20. mon.clear()
  21. for i, line in ipairs(t) do
  22. mon.setCursorPos(w - scroll, i)
  23. mon.write(line)
  24. end
  25. scroll = scroll + 1
  26. if scroll >= w + maxLen then
  27. scroll = 1
  28. end
  29. sleep(0.15)
  30. end
  31. end
  32.  
  33. term.clear()
  34. term.setCursorPos(1, 1)
  35. print("Scrolling text on the monitor...")
  36.  
  37. local mon = peripheral.wrap(sSide)
  38. mon.setTextScale(nTextScale)
  39. printScroll(mon, tText, sx)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement