Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local songList = "LajAJwja"
- local condense = "W3jHDPSX"
- local songPlayer = "695qWt0q"
- print("Downloading dependency...")
- shell.run("rm cond")
- shell.run("rm player")
- shell.run("rm .songlist")
- shell.run("pastebin get " .. condense .. " cond")
- shell.run("pastebin get " .. songPlayer .. " player")
- print("Updating list...")
- shell.run("rm .songlist")
- shell.run("pastebin get " .. songList .. " .songlist")
- print("Starting up...")
- print("-1")
- size = {term.getSize()}
- nb = peripheral.find("minecraft:noteblock")
- if not nb then
- if peripheral.find("neuralInterface") then
- if peripheral.find("neuralInterface").playNote then
- nb = peripheral.find("neuralInterface")
- end
- end
- end
- print("0")
- if ( not nb ) or ( not nb.playNote ) then
- term.setBackgroundColour(colours.lightGray)
- term.setTextColour(colours.gray)
- print("Couldn't locate noteblock")
- print("Playing may not work!",1)
- sleep(4)
- end
- print("1")
- clr = {}
- for i,k in pairs(colours) do
- if type(k) == "number" and i ~= "black" then
- table.insert(clr,k)
- end
- end
- term.clear()
- songs = {}
- f = fs.open(".songlist","r")
- while true do
- line = f.readLine()
- if not line then break else table.insert(songs,line) end
- end
- print("2")
- size = {term.getSize()}
- term.setCursorPos(1,size[2]/2)
- term.setTextColour(colours.white)
- term.write(">")
- function writeT(b)
- term.clear()
- term.setCursorPos(1,size[2]/2)
- term.write(">")
- str = 2-math.ceil((size[2]/2))
- line = 1
- term.setTextColour(colours.cyan)
- for i=str,str+size[2],1 do
- term.setCursorPos(3,line)
- term.write((songs[i+b] or "") .. string.rep(" ",30))
- line=line+1
- end
- term.setCursorPos(2,1)
- term.clearLine()
- term.setTextColour(clr[math.random(1,#clr)])
- term.write("Song Shop - " .. #songs .. " total songs!")
- end
- offset = 1
- writeT(offset)
- print("3")
- while true do
- a,b,c,d = os.pullEvent()
- if a == "key" then
- if b == 200 then --up
- offset = offset - 1
- elseif b == 208 then --down
- offset = offset + 1
- elseif b == 201 then --pgup
- offset = 0
- elseif b == 209 then --bgdwn
- offset = #songs-1
- elseif b == 28 then -- enter
- term.clear()
- term.setCursorPos(1,1)
- songname = songs[offset]
- if songname == ".song Player" then
- shell.run("pastebin get 695qWt0q songPlayer")
- else
- print("Downloading " .. songname)
- shell.run("wget http://hackery.site/computercraft/lua-songs/" .. songname:gsub(" ","%%20") .. ".lua temp")
- shell.run("cond temp .temp")
- shell.run("rm temp")
- shell.run("player .temp \"" .. songname .. "\"")
- shell.run("rm .temp")
- term.clear()
- term.setCursorPos(1,1)
- end
- end
- if offset < 1 then offset = 1 end
- if offset > #songs then offset = #songs end
- writeT(offset)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement