Advertisement
LazerAio

MUSIC

Mar 3rd, 2022
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. local CLEAN = true
  2. local TRACKS = 5
  3. local function viewBox(x,y,s,n)
  4. term.setBackgroundColor(colors.lightGray)
  5. term.setCursorPos(x,y)
  6. term.setCursorPos(x,y)
  7. print(n..(string.rep("-",string.len(s)-string.len(n))))
  8. term.setCursorPos(x,(y+1))
  9. print(s)
  10. term.setCursorPos(x, (y+2))
  11. print(s)
  12. term.setCursorPos(x, (y+3))
  13. print(s)
  14. term.setCursorPos(x, (y+4))
  15. print(s)
  16. term.setCursorPos(x, (y+4))
  17. print(s)
  18. term.setCursorPos(x, (y+5))
  19. print(s)
  20. term.setCursorPos(x, (y+6))
  21. print(s)
  22. term.setCursorPos(x, (y+7))
  23. print(s)
  24. term.setCursorPos(x, (y+8))
  25. print(s)
  26. term.setCursorPos(x, (y+9))
  27. print(s)
  28. term.setCursorPos(x, (y+10))
  29. print(string.rep("-",string.len(s)))
  30. end
  31. viewBox(15,7," ","MUSIC")
  32. term.setCursorPos(27,8)
  33. print("SIDE? :")
  34. term.setCursorPos(35,8)
  35. local side = read()
  36. sleep(0.5)
  37. local function MAIN(TRACKS,CLEAN)
  38. S = os.time()
  39. T = track
  40. track = nil
  41. L = 0
  42. while true do
  43. if track == T then
  44. IGNOREME = false
  45. else
  46. T = track
  47. S = os.time()
  48. end
  49. if CLEAN then
  50. term.setBackgroundColor(colors.black)
  51. term.clear()
  52. term.setBackgroundColor(colors.lightGray)
  53. end
  54. viewBox(15,7," ","MUSIC")
  55. term.setCursorPos(27,8)
  56. if track == nil then
  57. term.setTextColour(colors.red)
  58. print("NO TRACK LOADED")
  59. else
  60. term.setTextColour(colors.lime)
  61. print("Currently playing: "..track)
  62. end
  63. term.setCursorPos(27,9)
  64. print(os.date())
  65. term.setCursorPos(27,10)
  66. e, key = os.pullEvent()
  67. term.setCursorPos(27,12)
  68. print(" ")
  69. term.setCursorPos(16,12)
  70. print("The coder(s) of AiOs")
  71. term.setCursorPos(16,13)
  72. print("holds the copyright for")
  73. term.setCursorPos(16,14)
  74. print("some of the songs/tracks")
  75. term.setCursorPos(16,15)
  76. print("No copyright infringement intended")
  77. term.setCursorPos(26,10)
  78. if key == 32 then
  79. L = L + 1
  80. if L == TRACKS then
  81. L = 1
  82. end
  83. shell.run("speaker", "stop")
  84. sleep(1)
  85. term.setCursorPos(27,8)
  86. print(" ")
  87. term.setCursorPos(27,8)
  88. print("PAUSED")
  89. term.setCursorPos(27,9)
  90. print(" ")
  91. term.setCursorPos(27,9)
  92. --print("Track?: ")
  93. X = fs.list(".MUSIC/tracks")[tonumber(L)]
  94. term.setCursorPos(30,9)
  95. --X = read()
  96. term.setCursorPos(999,999)
  97. X = (".MUSIC/tracks/"..X)
  98. sleep(1)
  99. if CLEAN then
  100. term.clear()
  101. end
  102. shell.run("speaker", "play", X)
  103. if CLEAN then
  104. term.clear()
  105. term.setTextColour(colors.white)
  106. end
  107. track = X
  108. end
  109. end
  110. end
  111. MAIN(TRACKS,CLEAN)
  112.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement