Advertisement
XileHorizon

alongtimago

Feb 21st, 2025
5
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. local function iterator()
  2. return coroutine.wrap( function()
  3. for line in string.gmatch( filmText, "([^\n]*)\n") do
  4. coroutine.yield(line)
  5. end
  6. return false
  7. end )
  8. end
  9.  
  10. term.clear()
  11. local it = iterator()
  12.  
  13. local bFinished = false
  14. while not bFinished do
  15. -- Read the frame header
  16. local holdLine = it()
  17. if not holdLine then
  18. bFinished = true
  19. break
  20. end
  21.  
  22. -- Get this every frame incase the monitor resizes
  23. local w,h = term.getSize()
  24. local startX = math.floor( (w - 65) / 2 )
  25. local startY = math.floor( (h - 14) / 2 )
  26.  
  27. -- Print the frame
  28. term.clear()
  29. for n=1,13 do
  30. local line = it()
  31. if line then
  32. term.setCursorPos(startX, startY + n)
  33. term.write( line )
  34. else
  35. bFinished = true
  36. break
  37. end
  38. end
  39.  
  40. -- Hold the frame
  41. local hold = tonumber(holdLine) or 1
  42. local delay = (hold * 0.05) - 0.01
  43. sleep( delay )
  44. end
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement