SHOW:
|
|
- or go back to the newest paste.
| 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")
|
| 7 | + | |
| 8 | shell.run("pastebin get " .. songPlayer .. " player")
| |
| 9 | print("Updating list...")
| |
| 10 | shell.run("pastebin get " .. songList .. " .songlist")
| |
| 11 | - | shell.run("rm .songlist")
|
| 11 | + | |
| 12 | size = {term.getSize()}
| |
| 13 | nb = peripheral.find("Music") or peripheral.find("minecraft:noteblock")
| |
| 14 | if not nb then | |
| 15 | - | nb = peripheral.find("Music") or peripheral.find("minecraft:noteblock") or peripheral.find("speaker")
|
| 15 | + | |
| 16 | if peripheral.find("neuralInterface").playNote then
| |
| 17 | nb = peripheral.find("neuralInterface")
| |
| 18 | end | |
| 19 | end | |
| 20 | end | |
| 21 | local function centerText(text,yOffset) | |
| 22 | yOffset = yOffset or 0 | |
| 23 | local x,y = term.getSize() local x2,y2 = term.getCursorPos() | |
| 24 | term.setCursorPos(math.round((x / 2) - (text:len() / 2)), y2+yOffset) | |
| 25 | write(text) | |
| 26 | end | |
| 27 | if ( not nb ) or ( not nb.playNote ) then | |
| 28 | term.setBackgroundColour(colours.lightGrey) | |
| 29 | term.setTextColour(colours.gray) | |
| 30 | centerText("Couldn't locate noteblock")
| |
| 31 | - | term.setTextColour(colours.grey) |
| 31 | + | |
| 32 | sleep(4) | |
| 33 | end | |
| 34 | ||
| 35 | ||
| 36 | clr = {}
| |
| 37 | for i,k in pairs(colours) do | |
| 38 | if type(k) == "number" and i ~= "black" then | |
| 39 | table.insert(clr,k) | |
| 40 | end | |
| 41 | end | |
| 42 | ||
| 43 | term.clear() | |
| 44 | songs = {}
| |
| 45 | f = fs.open(".songlist","r")
| |
| 46 | while true do | |
| 47 | line = f.readLine() | |
| 48 | if not line then break else table.insert(songs,line) end | |
| 49 | end | |
| 50 | while true do | |
| 51 | songname = songs[math.random(1,#songs)] | |
| 52 | print("Downloading " .. songname)
| |
| 53 | shell.run("wget http://hackery.site/computercraft/lua-songs/" .. songname:gsub(" ","%%20") .. ".lua temp")
| |
| 54 | - | term.setCursorPos(1,size[2]/2) |
| 54 | + | |
| 55 | - | term.setTextColour(colours.white) |
| 55 | + | |
| 56 | - | term.write(">")
|
| 56 | + | |
| 57 | shell.run("rm .temp")
| |
| 58 | - | function writeT(b) |
| 58 | + | |
| 59 | - | term.clear() |
| 59 | + | |
| 60 | - | term.setCursorPos(1,size[2]/2) |
| 60 | + | sleep(1) |
| 61 | - | term.write(">")
|
| 61 | + |