Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --DJ Playlist by Poppamunz
- --This program will loop music discs in a playlist-type fashion.
- --Usage:
- --Place a turtle next to a disk drive. (Wired modems won't work)
- --Place all the music discs you want to loop in the turtle's inventory.
- --Run this program on the turtle.
- length = {
- ["C418 - strad"] = 188,
- ["C418 - 13"] = 178,
- ["C418 - cat"] = 185,
- ["C418 - blocks"] = 345,
- ["C418 - chirp"] = 185,
- ["C418 - far"] = 174,
- ["C418 - mall"] = 197,
- ["C418 - mellohi"] = 96,
- ["C418 - stal"] = 150,
- ["C418 - ward"] = 251,
- ["C418 - 11"] = 71,
- ["C418 - wait"] = 238,
- ["portalgun:wantyougone"] = 141,
- ["portalgun:stillalive"] = 176}
- assert(turtle,"Program must be run on a turtle.")
- for k,v in pairs(redstone.getSides()) do
- if peripheral.getType(v) == "drive" then
- side = v
- break
- end
- end
- if side == "left" then
- turtle.turnLeft()
- drive = peripheral.wrap("front")
- elseif side == "right" then
- turtle.turnRight()
- drive = peripheral.wrap("front")
- elseif side == "back" then
- turtle.turnRight()
- turtle.turnRight()
- drive = peripheral.wrap("front")
- elseif side == "top" then
- top = true
- drive = peripheral.wrap("top")
- elseif side == "bottom" then
- bottom = true
- drive = peripheral.wrap("bottom")
- else
- drive = peripheral.wrap("front")
- end
- function getItem()
- if top then
- turtle.suckUp()
- elseif bottom then
- turtle.suckDown()
- else
- turtle.suck()
- end
- end
- function putItem()
- if top then
- turtle.dropUp()
- elseif bottom then
- turtle.dropDown()
- else
- turtle.drop()
- end
- end
- function getItemToEmptySlot()
- for i=1, 16 do
- if turtle.getItemCount(i) == 0 then
- turtle.select(i)
- getItem()
- break
- end
- end
- end
- getItemToEmptySlot()
- turtle.select(1)
- selectedSlot = 1
- while true do
- putItem()
- if drive.hasAudio() then
- print("Now playing: ",drive.getAudioTitle())
- drive.playAudio()
- sleep(length[drive.getAudioTitle()])
- end
- getItem()
- if selectedSlot == 16 then
- selectedSlot = 1
- else
- selectedSlot = selectedSlot + 1
- end
- turtle.select(selectedSlot)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement