Rolcam

Computercraft Jukebox

Jun 13th, 2021 (edited)
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.39 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. shell.run("dj","stop")
  3. term.clear()
  4. while true do
  5.     term.setCursorPos(1,1)
  6.     term.setTextColor(colors.purple)
  7.     term.write("Digital Jukebox V3")
  8.     term.setCursorPos(1,5)
  9.     term.setTextColor(colors.orange)
  10.     term.write("Please enter track name or 'stop' to stop the music")
  11.     term.setCursorPos(1,6)
  12.     print("                                                     ")
  13.     term.setCursorPos(1,6)
  14.     local input = read()
  15.     -- Track 1 "13" - Yellow Disc
  16.     if input == "13" then
  17.         term.clear()
  18.         term.setCursorPos(1,3)
  19.         print("                                                     ")
  20.         term.setCursorPos(1,3)
  21.         term.setTextColor(colors.yellow)
  22.         shell.run("dj","play","drive_48")
  23.     -- Track 2 "cat/Cat" - Green Disc
  24.     elseif (input == "cat") or (input == "Cat") then
  25.         term.clear()
  26.         term.setCursorPos(1,3)
  27.         print("                                                     ")
  28.         term.setCursorPos(1,3)
  29.         term.setTextColor(colors.green)
  30.         shell.run("dj","play","drive_49")
  31.     -- Track 3 "blocks/Blocks" - Red Disc
  32.     elseif (input == "blocks") or (input == "Blocks") then
  33.         term.clear()
  34.         term.setCursorPos(1,3)
  35.         print("                                                     ")
  36.         term.setCursorPos(1,3)
  37.         term.setTextColor(colors.red)
  38.         shell.run("dj","play","drive_50")
  39.     -- Track 4 "chirp/Chirp" - Red Disc
  40.     elseif (input == "chirp") or (input == "Chirp") then
  41.         term.clear()
  42.         term.setCursorPos(1,3)
  43.         print("                                                     ")
  44.         term.setCursorPos(1,3)
  45.         term.setTextColor(colors.red)
  46.         shell.run("dj","play","drive_51")
  47.     -- Track 5 "far/Far" - Lime Disc
  48.     elseif (input == "far") or (input == "Far") then
  49.         term.clear()
  50.         term.setCursorPos(1,3)
  51.         print("                                                     ")
  52.         term.setCursorPos(1,3)
  53.         term.setTextColor(colors.lime)
  54.         shell.run("dj","play","drive_52")
  55.     -- Track 6 "mall/Mall" - Purple Disc
  56.     elseif (input == "mall") or (input == "Mall") then
  57.         term.clear()
  58.         term.setCursorPos(1,3)
  59.         print("                                                     ")
  60.         term.setCursorPos(1,3)
  61.         term.setTextColor(colors.purple)
  62.         shell.run("dj","play","drive_53")
  63.     -- Track 7 "mellohi/Mellohi" - Magenta Disc
  64.     elseif (input == "mellohi") or (input == "Mellohi") then
  65.         term.clear()
  66.         term.setCursorPos(1,3)
  67.         print("                                                     ")
  68.         term.setCursorPos(1,3)
  69.         term.setTextColor(colors.magenta)
  70.         shell.run("dj","play","drive_54")
  71.     -- Track 8 "stal/Stal"- Gray Disc
  72.     elseif (input == "stal") or (input == "Stal") then
  73.         term.clear()
  74.         term.setCursorPos(1,3)
  75.         print("                                                     ")
  76.         term.setCursorPos(1,3)
  77.         term.setTextColor(colors.gray)
  78.         shell.run("dj","play","drive_55")
  79.     -- Track 9 "strad/Strad" - White Disk
  80.     elseif (input == "strad") or (input == "Strad")then
  81.         term.clear()
  82.         term.setCursorPos(1,3)
  83.         print("                                                     ")
  84.         term.setCursorPos(1,3)
  85.         term.setTextColor(colors.white)
  86.         shell.run("dj","play","drive_56")
  87.     -- Track 10 "ward/Ward" - Green Disk
  88.     elseif (input == "ward") or (input == "Ward") then
  89.         term.clear()
  90.         term.setCursorPos(1,3)
  91.         print("                                                     ")
  92.         term.setCursorPos(1,3)
  93.         term.setTextColor(colors.green)
  94.         shell.run("dj","play","drive_57")
  95.     -- Track "11" - Gray Disc
  96.     elseif input == "11" then
  97.         term.clear()
  98.         term.setCursorPos(1,3)
  99.         print("                                                     ")
  100.         term.setCursorPos(1,3)
  101.         term.setTextColor(colors.gray)
  102.         shell.run("dj","play","drive_58")
  103.     -- Track 12 "wait/Wait" - Light Blue Disc
  104.     elseif (input == "wait") or (input == "Wait") then
  105.         term.clear()
  106.         term.setCursorPos(1,3)
  107.         print("                                                     ")
  108.         term.setCursorPos(1,3)
  109.         term.setTextColor(colors.lightBlue)
  110.         shell.run("dj","play","drive_59")
  111.     -- Stops music
  112.     elseif (input == "stop") or (input == "Stop") then
  113.         shell.run("dj","stop")
  114.         term.clear()
  115.     -- Invalid Command
  116.     else
  117.         term.setCursorPos(1,3)
  118.         print("                                                     ")
  119.         term.setCursorPos(1,3)
  120.         term.setTextColor(colors.red)
  121.         print("Invalid Selection")
  122.         sleep(2)
  123.     end
  124. end
Add Comment
Please, Sign In to add comment