Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args = {...}
- -- Change this to any connected monitor you want to use for system output
- mon = peripheral.wrap("monitor_2")
- -- This is the terminal's screen. Do not touch this!
- ter = term.current()
- -- If there are no arguments in the command then...
- if args == nil then
- term.setTextColor(colors.red)
- print("Warning: No parameters given!")
- print("Use \"play #\" to select a drive")
- -- Otherwise, if there are arguments, if they match the case do...
- else
- if args[1] == "1" then
- print("Playing Drive 1")
- -- Sets the tape command to refer to the connected tape drive. Change this to whatever drive you want to use
- -- Copy this if/elseif section to connect more drives
- tape = peripheral.wrap("tape_drive_0")
- -- Displays a "Now Playing" message on the connected monitor
- print("Now Playing: " .. tape.getLabel())
- term.redirect(mon)
- term.setTextColor(colors.orange)
- print("Now Playing:")
- print(tape.getLabel())
- term.redirect(ter)
- elseif args[1] == "2" then
- print("Playing Drive 2")
- tape = peripheral.wrap("tape_drive_1")
- print("Now Playing: " .. tape.getLabel())
- term.redirect(mon)
- term.setTextColor(colors.orange)
- print("Now Playing:")
- print(tape.getLabel())
- term.redirect(ter)
- elseif args[1] == "3" then
- print("Playing Drive 3")
- tape = peripheral.wrap("tape_drive_2")
- print("Now Playing: " .. tape.getLabel())
- term.redirect(mon)
- term.setTextColor(colors.orange)
- print("Now Playing:")
- print(tape.getLabel())
- term.redirect(ter)
- elseif args[1] == "all" then
- print("Playing All Drives. This is a bad idea, but you're the DJ, not me...")
- -- Drive 1
- tape = peripheral.wrap("tape_drive_0")
- if args[2] == nil then
- tape.seek(-tape.getSize())
- elseif args[2] == "hot" then
- term.setTextColor(colors.orange)
- print("hot parameter used! Not rewinding the tapes!")
- term.setTextColor(colors.white)
- else
- term.setTextColor(colors.red)
- print("Parameter 2 Invalid! Using Default Value...")
- term.setTextColor(colors.white)
- tape.seek(-tape.getSize())
- end
- print("Now Playing: " .. tape.getLabel())
- term.redirect(mon)
- term.setTextColor(colors.orange)
- print("Now Playing:")
- print(tape.getLabel())
- term.redirect(ter)
- tape.play()
- -- Drive 2
- tape = peripheral.wrap("tape_drive_1")
- if args[2] == nil then
- tape.seek(-tape.getSize())
- elseif args[2] == "hot" then
- term.setTextColor(colors.orange)
- print("hot parameter used! Not rewinding the tapes!")
- term.setTextColor(colors.white)
- else
- term.setTextColor(colors.red)
- print("Parameter 2 Invalid! Using Default Value...")
- term.setTextColor(colors.white)
- tape.seek(-tape.getSize())
- end
- print("Now Playing: " .. tape.getLabel())
- term.redirect(mon)
- term.setTextColor(colors.orange)
- print(tape.getLabel())
- term.redirect(ter)
- -- Drive 3
- tape.play()
- tape = peripheral.wrap("tape_drive_2")
- if args[2] == nil then
- tape.seek(-tape.getSize())
- elseif args[2] == "hot" then
- term.setTextColor(colors.orange)
- print("hot parameter used! Not rewinding the tapes!")
- term.setTextColor(colors.white)
- else
- term.setTextColor(colors.red)
- print("Parameter 2 Invalid! Using Default Value...")
- term.setTextColor(colors.white)
- tape.seek(-tape.getSize())
- end
- print("Now Playing: " .. tape.getLabel())
- term.redirect(mon)
- term.setTextColor(colors.orange)
- print(tape.getLabel())
- term.redirect(ter)
- else
- term.setTextColor(colors.red)
- print("Error: Parameter 1 Invalid! Please select a valid drive!")
- term.setTextColor(colors.white)
- end
- -- Rewinds and plays the tape for the selected drive
- if args[2] == nil then
- if tape == nil then
- sleep(0.1)
- else
- tape.seek(-tape.getSize())
- end
- elseif args[2] == "hot" then
- term.setTextColor(colors.orange)
- print("hot parameter used! Not rewinding the tape!")
- term.setTextColor(colors.white)
- else
- term.setTextColor(colors.red)
- print("Parameter 2 Invalid! Using Default Value...")
- term.setTextColor(colors.white)
- tape.seek(-tape.getSize())
- end
- if tape == nil then
- sleep(0.1)
- else
- tape.play()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement