Advertisement
HDR

Music System 1.5

HDR
Oct 27th, 2016
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.41 KB | None | 0 0
  1. -- Made By HDR @MartinRefseth
  2. sleep(0.2)
  3. os.loadAPI("button")
  4. for a,b in pairs(rs.getSides()) do
  5.   if peripheral.getType(b) == 'monitor' then
  6.    mon = peripheral.wrap(b)
  7.    break
  8.   end
  9. end
  10.  
  11.  
  12. -- Functions/Buttons
  13. function fillTable()
  14.    button.setTable("13", Thir, 2,12,3,5)
  15.    button.setTable("Cat", Cat, 14,24,3,5)
  16.    button.setTable("Blocks", Blocks, 26,36,3,5)
  17.    button.setTable("Chirp", Chirp, 38,48,3,5)
  18.    button.setTable("Far", Far, 50,60,3,5)
  19.    button.setTable("Mall", Mall, 2,12,7,9)
  20.    button.setTable("Mellohi", Mellohi, 14,24,7,9)    
  21.    button.setTable("Stal", Stal, 26,36,7,9)
  22.    button.setTable("Strad", Strad, 38,48,7,9)
  23.    button.setTable("Ward", Ward, 50,60,7,9)
  24.    button.setTable("11", Elev, 2,12,11,13)
  25.    button.setTable("Wait", Wait, 14,24,11,13)
  26.    button.setTable("???", Question, 26,36,11,13)
  27.    button.setTable("Gaia 1", GaiaOne, 38,48,11,13)
  28.    button.setTable("Gaia 2", GaiaTwo, 50,60,11,13)
  29.    button.setTable("Still Alive", Slive, 20,30,15,17)
  30.    button.setTable("Radio Loop", Roop, 8,18,15,17)
  31.    button.setTable("Want You", WYG, 32,42,15,17)
  32.    button.setTable("Wanderer", Wander, 44,54,15,17)  
  33.    button.setTable("Stop", Stop, 20,30,19,20)
  34.    button.setTable("Reboot", Reboot, 32,42,19,20)
  35.    button.screen()
  36. end
  37.  
  38. function getClick()
  39.    event,side,x,y = os.pullEvent("monitor_touch")
  40.    button.checkxy(x,y)
  41. end
  42.  
  43. -- Functions
  44. function Thir()
  45.    button.flash("13")
  46.    print("Loading 13")
  47.  local title = "C418 - 13"
  48.  peripheral.find("drive", disk.stopAudio)
  49.  peripheral.find( "drive", function( name )
  50.   if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
  51.     disk.playAudio( name )
  52.   end
  53.  end )
  54. end
  55.  
  56. function Cat()
  57.    button.flash("Cat")
  58.    print("Loading Cat")
  59.  local title = "C418 - cat"
  60.  peripheral.find("drive", disk.stopAudio)
  61.  peripheral.find( "drive", function( name )
  62.   if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
  63.     disk.playAudio( name )
  64.   end
  65.  end )
  66. end
  67.  
  68. function Blocks()
  69.    button.flash("Blocks")
  70.    print("Loading Blocks")
  71.    peripheral.find("drive", disk.stopAudio)
  72.  local title = "C418 - blocks"
  73.  peripheral.find("drive", disk.stopAudio)
  74.  peripheral.find( "drive", function( name )
  75.   if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
  76.     disk.playAudio( name )
  77.   end
  78.  end )
  79. end  
  80.  
  81. function Chirp()
  82.    button.flash("Chirp")
  83.    print("Loading Chirp")
  84.    peripheral.find("drive", disk.stopAudio)
  85.  local title = "C418 - chirp"
  86.  peripheral.find("drive", disk.stopAudio)
  87.  peripheral.find( "drive", function( name )
  88.   if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
  89.     disk.playAudio( name )
  90.   end
  91.  end )
  92. end  
  93.  
  94. function Far()
  95.    button.flash("Far")
  96.    print("Loading Far")
  97.    peripheral.find("drive", disk.stopAudio)
  98.  local title = "C418 - far"
  99.  peripheral.find("drive", disk.stopAudio)
  100.  peripheral.find( "drive", function( name )
  101.   if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
  102.     disk.playAudio( name )
  103.   end
  104.  end )
  105. end
  106.  
  107. function Mall()
  108.    button.flash("Mall")
  109.    print("Loading Mall")
  110.    peripheral.find("drive", disk.stopAudio)
  111.  local title = "C418 - mall"
  112.  peripheral.find("drive", disk.stopAudio)
  113.  peripheral.find( "drive", function( name )
  114.   if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
  115.     disk.playAudio( name )
  116.   end
  117.  end )
  118. end
  119.  
  120. function Mellohi()
  121.    button.flash("Mellohi")
  122.    print("Loading Mellohi")
  123.    peripheral.find("drive", disk.stopAudio)
  124.  local title = "C418 - mellohi"
  125.  peripheral.find("drive", disk.stopAudio)
  126.  peripheral.find( "drive", function( name )
  127.   if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
  128.     disk.playAudio( name )
  129.   end
  130.  end )
  131. end
  132.  
  133. function Stal()
  134.    button.flash("Stal")
  135.    print("Loading Stal")
  136.    peripheral.find("drive", disk.stopAudio)
  137.  local title = "C418 - stal"
  138.  peripheral.find("drive", disk.stopAudio)
  139.  peripheral.find( "drive", function( name )
  140.   if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
  141.     disk.playAudio( name )
  142.   end
  143.  end )
  144. end
  145.  
  146. function Strad()
  147.    button.flash("Strad")
  148.    print("Loading Strad")
  149.    peripheral.find("drive", disk.stopAudio)
  150.  local title = "C418 - strad"
  151.  peripheral.find("drive", disk.stopAudio)
  152.  peripheral.find( "drive", function( name )
  153.   if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
  154.     disk.playAudio( name )
  155.   end
  156.  end )
  157. end
  158.    
  159. function Ward()
  160.    button.flash("Ward")
  161.    print("Loading Ward")
  162.    peripheral.find("drive", disk.stopAudio)
  163.  local title = "C418 - ward"
  164.  peripheral.find("drive", disk.stopAudio)
  165.  peripheral.find( "drive", function( name )
  166.   if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
  167.     disk.playAudio( name )
  168.   end
  169.  end )
  170. end
  171.  
  172. function Elev()
  173.    button.flash("11")
  174.    print("Loading 11")
  175.    peripheral.find("drive", disk.stopAudio)
  176.  local title = "C418 - 11"
  177.  peripheral.find("drive", disk.stopAudio)
  178.  peripheral.find( "drive", function( name )
  179.   if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
  180.     disk.playAudio( name )
  181.   end
  182.  end )
  183. end
  184.  
  185. function Wait()
  186.    button.flash("Wait")
  187.    print("Loading Wait")
  188.    peripheral.find("drive", disk.stopAudio)
  189.  local title = "C418 - wait"
  190.  peripheral.find("drive", disk.stopAudio)
  191.  peripheral.find( "drive", function( name )
  192.   if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
  193.     disk.playAudio( name )
  194.   end
  195.  end )
  196. end
  197.  
  198. function Question()
  199.    button.flash("???")
  200.    print("Loading ???")
  201.    peripheral.find("drive", disk.stopAudio)
  202.  local title = "corruption"
  203.  peripheral.find("drive", disk.stopAudio)
  204.  peripheral.find( "drive", function( name )
  205.   if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
  206.     disk.playAudio( name )
  207.   end
  208.  end )
  209. end
  210.  
  211. function GaiaOne()
  212.    button.flash("Gaia 1")
  213.    print("Loading Gaia 1")
  214.    peripheral.find("drive", disk.stopAudio)
  215.  local title = "botania:gaia1"
  216.  peripheral.find("drive", disk.stopAudio)
  217.  peripheral.find( "drive", function( name )
  218.   if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
  219.     disk.playAudio( name )
  220.   end
  221.  end )
  222. end
  223.  
  224. function GaiaTwo()
  225.    button.flash("Gaia 2")
  226.    print("Loading Gaia 2")
  227.    peripheral.find("drive", disk.stopAudio)
  228.  local title = "botania:gaia2"
  229.  peripheral.find("drive", disk.stopAudio)
  230.  peripheral.find( "drive", function( name )
  231.   if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
  232.     disk.playAudio( name )
  233.   end
  234.  end )
  235. end
  236.  
  237. function Roop()
  238.    button.flash("Radio Loop")
  239.    print("Loading Radio Loop")
  240.    peripheral.find("drive", disk.stopAudio)
  241.  local title = "portalgun:records.radioloop"
  242.  peripheral.find("drive", disk.stopAudio)
  243.  peripheral.find( "drive", function( name )
  244.   if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
  245.     disk.playAudio( name )
  246.   end
  247.  end )
  248. end
  249.  
  250. function Slive()
  251.    button.flash("Still Alive")
  252.    print("Loading Still Alive")
  253.    peripheral.find("drive", disk.stopAudio)
  254.  local title = "portalgun:records.stillalive"
  255.  peripheral.find("drive", disk.stopAudio)
  256.  peripheral.find( "drive", function( name )
  257.   if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
  258.     disk.playAudio( name )
  259.   end
  260.  end )
  261. end
  262.  
  263. function WYG()
  264.    button.flash("Want You")
  265.    print("Loading Want You Gone")
  266.    peripheral.find("drive", disk.stopAudio)
  267.  local title = "portalgun:records.wantyougone"
  268.  peripheral.find("drive", disk.stopAudio)
  269.  peripheral.find( "drive", function( name )
  270.   if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
  271.     disk.playAudio( name )
  272.   end
  273.  end )
  274. end
  275.  
  276. function Wander()
  277.     button.flash("Wanderer")
  278.     print("Loading Wanderer")
  279.     peripheral.find("drive", disk.stopAudio)
  280.  local title = "wanderer"
  281.  peripheral.find("drive", disk.stopAudio)
  282.  peripheral.find( "drive", function( name )
  283.   if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
  284.     disk.playAudio( name )
  285.   end
  286.  end )
  287. end
  288.  
  289. function Stop()
  290.    button.flash("Stop")
  291.    print("Stopping Disk")
  292.    peripheral.find("drive", disk.stopAudio)
  293. end
  294. function Reboot()
  295.    button.flash("Reboot")
  296.    print("Rebooting")
  297.    peripheral.find("drive", disk.stopAudio)
  298.    mon.clear()
  299.    os.reboot()
  300. end
  301. -- Heading      
  302. local greeting = "HDR's Music System V1.5"
  303.  
  304. fillTable()
  305. button.heading(greeting)
  306.  
  307. while true do
  308.    getClick()
  309. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement