Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Check out this program in action on my Youtube page
- -- http://www.youtube.com/user/chronnotrigg
- -- Last edit 12-06-15 6:18pm
- Slot = 0
- st = 0
- local plays = { ... }
- pSlot = 0
- function setup()
- turtle.up()
- turtle.select(16)
- turtle.placeDown()
- end
- function teardown()
- turtle.select(16)
- turtle.digDown()
- turtle.down()
- end
- function gui(T)
- term.clear()
- term.setCursorPos(1,1)
- print("Press E to exit, any other key to skip")
- term.setCursorPos(1,3)
- print("Currently ")
- term.setCursorPos(11,3)
- print(disk.getLabel("bottom"))
- end
- function play(S)
- turtle.select(S)
- turtle.dropDown()
- gui()
- disk.playAudio("bottom")
- end
- function stop(S)
- disk.stopAudio("bottom")
- turtle.select(S)
- turtle.suckDown()
- end
- function getSlot()
- Slot = math.random(1,15)
- if Slot == pSlot then
- getSlot()
- else
- pSlot = Slot
- end
- if turtle.getItemCount(Slot) == 0 then
- getSlot()
- end
- end
- function sleep()
- if disk.getLabel("bottom") == "C418 - mall" then
- os.sleep(202)
- elseif disk.getLabel("bottom") == "C418 - mellohi" then
- os.sleep(101)
- elseif disk.getLabel("bottom") == "C418 - wait" then
- os.sleep(243)
- elseif disk.getLabel("bottom") == "C418 - ward" then
- os.sleep(256)
- elseif disk.getLabel("bottom") == "C418 - 13" then
- os.sleep(183)
- elseif disk.getLabel("bottom") == "C418 - cat" then
- os.sleep(190)
- elseif disk.getLabel("bottom") == "C418 - blocks" then
- os.sleep(350)
- elseif disk.getLabel("bottom") == "C418 - chirp" then
- os.sleep(190)
- elseif disk.getLabel("bottom") == "C418 - far" then
- os.sleep(179)
- elseif disk.getLabel("bottom") == "C418 - stal" then
- os.sleep(155)
- elseif disk.getLabel("bottom") == "C418 - strad" then
- os.sleep(193)
- elseif disk.getLabel("bottom") == "C418 - 11" then
- os.sleep(76)
- elseif disk.getLabel("bottom") == "Valve - Still Alive" then
- os.sleep(181)
- elseif disk.getLabel("bottom") == "pg.stillalive" then
- os.sleep(181)
- elseif disk.getLabel("bottom") == "Valve - Want You Gone" then
- os.sleep(146)
- elseif disk.getLabel("bottom") == "pg.wantyougone" then
- os.sleep(146)
- elseif disk.getLabel("bottom") == "Valve - Radio Loop" then
- os.sleep(26)
- elseif disk.getLabel("bottom") == "pg.radioloop" then
- os.sleep(26)
- else
- os.sleep(240)
- end
- end
- function compu()
- local event, arg1=os.pullEvent("char")
- if arg1=="e" then
- stop(Slot)
- st = 1
- else
- os.sleep(0)
- end
- end
- disk.stopAudio("bottom")
- turtle.suckDown()
- if plays[1] == 0 then
- print("argument must be greater than 0")
- elseif plays[1] == plays[111] then
- plays[1] = 0
- end
- setup()
- for i=1,plays[1] do
- if st == 1 then
- break
- end
- getSlot()
- play(Slot)
- parallel.waitForAny(compu, sleep)
- stop(Slot)
- end
- teardown()
- term.clear()
- term.setCursorPos(1,1)
- print("Playback Finished")
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement