Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --SV Music Maker
- debug = true
- noten = {"fis", "g", "gis", "a", "ais", "h", "c1", "cis1", "d1", "dis1", "e1", "f1", "fis1", "g1", "gis1", "a1", "ais1", "h1", "c2", "cis2", "d2", "dis2", "e2", "f2", "fis2"}
- back = "c1"
- right = "d1"
- bottom = "e1"
- left = "f1"
- function klicks(note)
- for i=1, #noten do
- if note == noten[i] then
- anzahlKlicks = i-1
- print("For "..note.." click "..anzahlKlicks.." times.")
- end
- end
- end
- function play(note)
- if debug then
- print("function play")
- end
- if note == back then
- redstone.setOutput("back", true)
- elseif note == right then
- redstone.setOutput("right", true)
- elseif note == bottom then
- redstone.setOutput("bottom", true)
- elseif note == left then
- redstone.setOutput("left", true)
- end
- sleep(0.01)
- redstone.setOutput("back", false)
- redstone.setOutput("right", false)
- redstone.setOutput("bottom", false)
- redstone.setOutput("left", false)
- end
- function music()
- rednet.open("top")
- while true do
- local id, toPlay = rednet.receive()
- play(toPlay)
- end
- end
- function menu()
- while true do
- print("Type help for a list of commands.")
- input = read()
- if input == "help" then
- print("Type set to change notes,")
- print("Type clicks to see the clicks.")
- end
- if input == "set" then
- print("Set notes: back, right, bottom, left")
- write("back: ")
- back = read()
- write("right: ")
- right = read()
- write("bottom: ")
- bottom = read()
- write("left: ")
- left = read()
- if debug then
- print("open /SVMM/bindings in mode w")
- end
- --[[file = fs.open("/SVMM/bindings", "w")
- print("back")
- file.writeLine("back")
- print("right")
- file.writeLine(right)
- file.writeLine(bottom)
- file.writeLine(left)
- fs.close()]]--
- end
- if input == "clicks" then
- klicks(back)
- klicks(right)
- klicks(bottom)
- klicks(left)
- end
- end
- end
- print("Running Parallel.")
- parallel.waitForAll(menu, music)
- klicks(back)
- klicks(right)
- klicks(bottom)
- klicks(left)
Advertisement
Add Comment
Please, Sign In to add comment