Clinky

Film Player (Computer Craft)

Jan 24th, 2021 (edited)
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. -- To install
  2. -- pastebin get PQr3vPv0 player
  3.  
  4. -- Define all reels in DEFINE REELS section below
  5. -- Define several useful variables up here
  6.  
  7. -- Change top to (bottom, left, right, front, back) when needed
  8. local m = peripheral.wrap("top")
  9. -- Frames Per Second
  10. local fps = 15
  11. -- Left margin in characters (starting from 1 not 0)
  12. local leftMargin = 4
  13. -- Top margin in characters (starting from 1 not 0)
  14. local topMargin = 4
  15. -- Sets the scale of the text
  16. local textScale = 20/15
  17. -- changeReelOn, if true, Outputs redstone all around
  18. -- the computer for ten seconds and prints Changing Reel
  19. -- in big text. Does nothing if false.
  20. local changeReelOn = true
  21.  
  22. -- playReel function
  23. function playReel(reel, lengthInFrames, frameHeight)
  24. m.setTextScale(textScale)
  25. m.setCursorPos(leftMargin,topMargin)
  26. local reel = fs.open(reel,"r")
  27.  
  28. for k = 1,lengthInFrames do
  29. m.clear() -- Clears the screen for the next frame.
  30. -- Updates frameCount (If this is giving an error,
  31. -- make sure your frameHeight is correct)
  32. local frameCount = tonumber(reel.readLine())
  33. for i = 1, frameHeight do
  34. m.setCursorPos(leftMargin,i+topMargin)
  35. m.write(reel.readLine())
  36. end
  37. sleep(frameCount/fps) -- This determines the FPS
  38. end
  39. reel.close()
  40. end
  41.  
  42. -- DEFINE REELS DEFINE REELS DEFINE REELS DEFINE REELS DEFINE REELS
  43. --
  44. -- Each reel should be a list within the reel list
  45. -- Format: playReel("title.txt", length of reel in unique frames, height to display at)
  46. --
  47. --playReel("star1", 794, 13)
  48. --playReel("star2", 724, 13)
  49. --playReel("star3", 727, 13)
  50. --playReel("star4", 594, 13)
  51. --playReel("star5", 571, 13)
  52. --
  53. -- END DEFINE REELS END DEFINE REELS END DEFINE REELS END DEFINE REELS
  54. -- STARWARS EP IV REELS
  55. -- pastebin get tj7vUqcJ star1
  56. -- pastebin get jGXWJ0QB star2
  57. -- pastebin get S4bzEx3j star3
  58. -- pastebin get yifuceXV star4
  59. -- pastebin get whhNhKZr star5
  60.  
  61. -- Signals next computer to start playing, or that someone should play from the next computer.
  62. if changeReelOn == true then
  63. m.clear()
  64. m.setCursorPos(1,1)
  65. m.setTextScale(4)
  66. m.write("Changing Reel")
  67. redstone.setOutput("left", true)
  68. sleep(15)
  69. redstone.setOutput("left", false)
  70. end
Advertisement
Add Comment
Please, Sign In to add comment