Advertisement
TheRockettek

Untitled

Apr 29th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 KB | None | 0 0
  1. local songList = "LajAJwja"
  2. local condense = "W3jHDPSX"
  3. local songPlayer = "695qWt0q"
  4. print("Downloading dependency...")
  5. shell.run("rm cond")
  6. shell.run("rm player")
  7. shell.run("rm .songlist")
  8. shell.run("pastebin get " .. condense .. " cond")
  9. shell.run("pastebin get " .. songPlayer .. " player")
  10. print("Updating list...")
  11. shell.run("rm .songlist")
  12. shell.run("pastebin get " .. songList .. " .songlist")
  13. print("Starting up...")
  14. print("-1")
  15. size = {term.getSize()}
  16. nb = peripheral.find("minecraft:noteblock")
  17. if not nb then
  18. if peripheral.find("neuralInterface") then
  19. if peripheral.find("neuralInterface").playNote then
  20. nb = peripheral.find("neuralInterface")
  21. end
  22. end
  23. end
  24. print("0")
  25. if ( not nb ) or ( not nb.playNote ) then
  26. term.setBackgroundColour(colours.lightGray)
  27. term.setTextColour(colours.gray)
  28. print("Couldn't locate noteblock")
  29. print("Playing may not work!",1)
  30. sleep(4)
  31. end
  32. print("1")
  33.  
  34.  
  35. clr = {}
  36. for i,k in pairs(colours) do
  37. if type(k) == "number" and i ~= "black" then
  38. table.insert(clr,k)
  39. end
  40. end
  41.  
  42. term.clear()
  43. songs = {}
  44. f = fs.open(".songlist","r")
  45. while true do
  46. line = f.readLine()
  47. if not line then break else table.insert(songs,line) end
  48. end
  49.  
  50. print("2")
  51.  
  52. size = {term.getSize()}
  53. term.setCursorPos(1,size[2]/2)
  54. term.setTextColour(colours.white)
  55. term.write(">")
  56.  
  57. function writeT(b)
  58. term.clear()
  59. term.setCursorPos(1,size[2]/2)
  60. term.write(">")
  61. str = 2-math.ceil((size[2]/2))
  62. line = 1
  63. term.setTextColour(colours.cyan)
  64. for i=str,str+size[2],1 do
  65. term.setCursorPos(3,line)
  66. term.write((songs[i+b] or "") .. string.rep(" ",30))
  67. line=line+1
  68. end
  69. term.setCursorPos(2,1)
  70. term.clearLine()
  71. term.setTextColour(clr[math.random(1,#clr)])
  72. term.write("Song Shop - " .. #songs .. " total songs!")
  73. end
  74.  
  75. offset = 1
  76. writeT(offset)
  77.  
  78. print("3")
  79.  
  80. while true do
  81. a,b,c,d = os.pullEvent()
  82. if a == "key" then
  83. if b == 200 then --up
  84. offset = offset - 1
  85. elseif b == 208 then --down
  86. offset = offset + 1
  87. elseif b == 201 then --pgup
  88. offset = 0
  89. elseif b == 209 then --bgdwn
  90. offset = #songs-1
  91. elseif b == 28 then -- enter
  92. term.clear()
  93. term.setCursorPos(1,1)
  94. songname = songs[offset]
  95. if songname == ".song Player" then
  96. shell.run("pastebin get 695qWt0q songPlayer")
  97. else
  98. print("Downloading " .. songname)
  99. shell.run("wget http://hackery.site/computercraft/lua-songs/" .. songname:gsub(" ","%%20") .. ".lua temp")
  100. shell.run("cond temp .temp")
  101. shell.run("rm temp")
  102. shell.run("player .temp \"" .. songname .. "\"")
  103. shell.run("rm .temp")
  104. term.clear()
  105. term.setCursorPos(1,1)
  106. end
  107. end
  108. if offset < 1 then offset = 1 end
  109. if offset > #songs then offset = #songs end
  110. writeT(offset)
  111. end
  112. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement