zurbo

cc_jukebox

Dec 17th, 2012
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos (1,1)
  3. print "JukebOS 1.0"
  4.  
  5. local monitor = peripheral.wrap("top")
  6. monitor.clear()
  7. monitor.setTextScale(1.5)
  8.  
  9. while true do
  10.  
  11.   while not disk.hasAudio("left") do
  12.     monitor.setCursorPos(5,2)
  13.     monitor.write("Inserez un cd audio")
  14.     sleep(0.01)
  15.   end
  16.  
  17.   monitor.clear()
  18.   monitor.setCursorPos(5,2)
  19.   monitor.write("||")
  20.   monitor.setCursorPos(8,2)
  21.   monitor.write(disk.getAudioTitle("left"))
  22.  
  23.   local stop2 = false
  24.   local stop1 = true
  25.  
  26.   while stop2 == false do
  27.    
  28.     sleep(0.1)
  29.    
  30.     if redstone.getInput("back") then
  31.       monitor.setCursorPos(5,2)
  32.       monitor.write("> ")
  33.       disk.playAudio("left")
  34.       stop1 = false
  35.       sleep(1)
  36.     end
  37.    
  38.     if (redstone.getInput("right")) and (stop1 == false) then
  39.       monitor.setCursorPos(5,2)
  40.       monitor.write("||")
  41.       disk.stopAudio("left")
  42.       stop1 = true
  43.       sleep(1)
  44.     end
  45.    
  46.     if ((redstone.getInput("right")) and (stop1 == true)) or (not disk.hasAudio("left")) then
  47.       stop2 = true
  48.       disk.eject("left")
  49.       monitor.clear()
  50.     end
  51.   end
  52. end
Advertisement
Add Comment
Please, Sign In to add comment