rules54

Untitled

Jul 1st, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. disk = {...}
  2. titles = {...}
  3. chat = peripheral.wrap("front")
  4. drive = peripheral.wrap("bottom")
  5. loopValue = true
  6.  
  7. print("Running Remote DJ Program")
  8. print("Type, 'record help' in chat for commands")
  9.  
  10. print("Retreiving disk titles..")
  11. turtle.select(1) turtle.suckDown()
  12. for i=1,16 do
  13. if turtle.getItemCount(i) == 1 then
  14. turtle.select(i)
  15. turtle.dropDown()
  16. table.insert(disk, drive.getAudioTitle())
  17. turtle.suckDown()
  18. end
  19. end
  20. print("Reformatting disk titles..")
  21.  
  22. for i=1, #disk do
  23. title(disk[i],"13","13")
  24. title(disk[i],"cat","cat")
  25. title(disk[i],"blocks","blocks")
  26. title(disk[i],"chirp","chirp")
  27. title(disk[i],"far","far")
  28. title(disk[i],"mall","mall")
  29. title(disk[i],"mellohi","mellohi")
  30. title(disk[i],"stal","stal")
  31. title(disk[i],"strad","strad")
  32. title(disk[i],"ward","ward")
  33. title(disk[i],"11", "11")
  34. title(disk[i],"wait", "wait")
  35. title(disk[i],"pg.wantyougone","Want You Gone")
  36. title(disk[i],"pg.stillalive","Still Alive")
  37. end
  38.  
  39.  
  40. diskString = ""
  41. for i=1, #titles-1 do
  42. diskString = diskString.. i..": "..titles[i]..", "
  43. end
  44.  
  45. diskString = diskString..#titles..": "..titles[#titles]
  46.  
  47. print("Formatted titles into string:")
  48. print(diskString)
  49. print("Beginning loop.")
  50.  
  51.  
  52. while loopValue do
  53. event, player, msg = os.pullEvent("chat")
  54. message = string.lower(msg)
  55. if string.find(message, "record list") ~= nil then
  56. os.sleep(.1)
  57. chat.tell(player, diskString)
  58. elseif string.find(message,"record play") ~= nil then
  59. turtle.suckDown()
  60. for i=1, 16 do
  61. if string.find(message,i) ~= nil then
  62. turtle.select(i) turtle.dropDown()
  63. drive.playAudio()
  64. end
  65. end
  66. elseif string.find(message, "record stop") ~= nil then
  67. turtle.suckDown()
  68. elseif string.find(message, "record shuffle") ~= nil then
  69. turtle.suckDown() turtle.select(math.random(1,#disk))
  70. turtle.dropDown() drive.playAudio()
  71. elseif string.find(message, "record reload") ~= nil then
  72. os.reboot()
  73. elseif string.find(message, "record help") ~= nil then
  74. os.sleep(.1)
  75. chat.tell(player, "Available commands: (all prefixed with 'record')")
  76. chat.tell(player, "Help, List, Play <disk number>, Stop, Shuffle, Reload.")
  77. end
  78. end
  79.  
  80.  
  81.  
  82. -- for i=1, #disk do print(disk[i]) end
Advertisement
Add Comment
Please, Sign In to add comment