Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- printerSide = "front"
- ejectRedstoneSide = "left"
- recordSide = "bottom"
- function play(dside,rrside,acolor)
- if value2 == "white" then theColor=1
- elseif value2 == "orange" then theColor=2
- elseif value2 == "magenta" then theColor=4
- elseif value2 == "lightblue" then theColor=8
- elseif value2 == "yellow" then theColor=16
- elseif value2 == "lime" then theColor=32
- elseif value2 == "pink" then theColor=64
- elseif value2 == "gray" then theColor=128
- elseif value2 == "lightgray" then theColor=256
- elseif value2 == "cyan" then theColor=512
- elseif value2 == "purple" then theColor=1024
- elseif value2 == "blue" then theColor=2048
- elseif value2 == "brown" then theColor=4096
- elseif value2 == "green" then theColor=8192
- elseif value2 == "red" then theColor=16384
- elseif value2 == "black" then theColor=32768
- else print("Error: color out of range") return
- end
- print("loading track")
- redstone.setBundledOutput(rrside, theColor)
- sleep(1)
- redstone.setBundledOutput(rrside, 0)
- while not disk.isPresent(dside) do
- sleep(.5)
- end
- print("track loaded, playing track")
- disk.playAudio(dside)
- end
- function stop(dside)
- print("stopping track")
- disk.stopAudio(dside)
- end
- function eject(drside)
- print("ejecting track")
- redstone.setOutput(drside, true)
- sleep(1)
- redstone.setOutput(drside, false)
- end
- local tArgs = { ... }
- h = fs.open("music-colors","r")
- line = tostring(h.readLine())
- if tArgs[1] == "play" then
- while line ~= nil do
- value1,value2 = string.match(line,"(.+)%s?:%s?(.+)")
- if value1 == tArgs[2] then
- print("You want to play "..value1)
- print("It is on the "..value2.." line")
- play(printerSide,recordSide,value2)
- return
- end
- line = h.readLine()
- end
- print ("The disk "..tArgs[2].." isn't loaded")
- end
- if tArgs[1] == "stop" then
- stop(printerSide)
- end
- if tArgs[1] == "eject" then
- eject(ejectRedstoneSide)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement