Advertisement
Mackan90096

Scroll

Mar 28th, 2015
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.76 KB | None | 0 0
  1. local tText = {
  2.   "LOREM IPSUM DOLOR SIT AMET"
  3. }
  4. local sSide = "back"
  5. local nTextScale = 2
  6.  
  7. local function printScroll(mon, t)
  8.     local w, h = mon.getSize()
  9.     local scroll = 1
  10.     local maxLen
  11.     for i, line in ipairs(t) do
  12.         if not maxLen or #line > maxLen then
  13.             maxLen = #line
  14.         end
  15.     end
  16.     while true do
  17.         mon.clear()
  18.         for i, line in ipairs(t) do
  19.             mon.setCursorPos(w - scroll, i)
  20.             mon.write(line)
  21.         end
  22.         scroll = scroll + 1
  23.         if scroll >= w + maxLen then
  24.             scroll = 1
  25.         end
  26.         sleep(0.15)
  27.     end
  28. end
  29.  
  30. term.clear()
  31. term.setCursorPos(1, 1)
  32.  
  33. local mon = peripheral.wrap(sSide)
  34. mon.setTextScale(nTextScale)
  35. printScroll(mon, tText, sx)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement