Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- disk = {...}
- titles = {...}
- chat = peripheral.wrap("front")
- drive = peripheral.wrap("bottom")
- loopValue = true
- function title(var, var2, var4)
- if string.find(var, var2) ~= nil then
- table.insert(titles, var4)
- end
- end
- print("Running Remote DJ Program")
- print("Type, 'record help' in chat for commands")
- print("Retreiving disk titles..")
- turtle.select(1) turtle.suckDown()
- for i=1,16 do
- if turtle.getItemCount(i) == 1 then
- turtle.select(i)
- turtle.dropDown()
- table.insert(disk, drive.getAudioTitle())
- turtle.suckDown()
- end
- end
- print("Reformatting disk titles..")
- for i=1, #disk do
- title(disk[i],"13","13")
- title(disk[i],"cat","cat")
- title(disk[i],"blocks","blocks")
- title(disk[i],"chirp","chirp")
- title(disk[i],"far","far")
- title(disk[i],"mall","mall")
- title(disk[i],"mellohi","mellohi")
- title(disk[i],"stal","stal")
- title(disk[i],"strad","strad")
- title(disk[i],"ward","ward")
- title(disk[i],"11", "11")
- title(disk[i],"wait", "wait")
- title(disk[i],"pg.wantyougone","Want You Gone")
- title(disk[i],"pg.stillalive","Still Alive")
- end
- diskString = ""
- for i=1, #titles-1 do
- diskString = diskString.. i..": "..titles[i]..", "
- end
- diskString = diskString..#titles..": "..titles[#titles]
- print("Formatted titles into string:")
- print(diskString)
- print("Beginning loop.")
- while loopValue do
- event, player, msg = os.pullEvent("chat")
- message = string.lower(msg)
- if string.find(message, "record list") ~= nil then
- os.sleep(.1)
- chat.tell(player, diskString)
- elseif string.find(message,"record play") ~= nil then
- turtle.suckDown()
- for i=1, 16 do
- if string.find(message,i) ~= nil then
- turtle.select(i) turtle.dropDown()
- drive.playAudio()
- end
- end
- elseif string.find(message, "record stop") ~= nil then
- turtle.suckDown()
- elseif string.find(message, "record shuffle") ~= nil then
- turtle.suckDown() turtle.select(math.random(1,#disk))
- turtle.dropDown() drive.playAudio()
- elseif string.find(message, "record reload") ~= nil then
- os.reboot()
- elseif string.find(message, "record help") ~= nil then
- os.sleep(.1)
- chat.tell(player, "Available commands: (all prefixed with 'record')")
- chat.tell(player, "Help, List, Play <disk number>, Stop, Shuffle, Reload.")
- end
- end
- -- for i=1, #disk do print(disk[i]) end
Advertisement
Add Comment
Please, Sign In to add comment