Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wire="left"
- function Main()
- term.clear()
- term.setCursorPos(1,1)
- print("PIANO! v1.0\nby Jahmaican\n\n| | | | | | | | | | |\n| | w | e | | | t | y | u | | |\n| |___|___| | |___|___|___| | |\n| a | s | d | f | g | h | j | k |\n|___|___|___|___|___|___|___|___|\n\n[Press SPACE to exit]")
- Keys()
- end
- function Keys()
- local event,p1=nil
- event,p1=os.pullEvent("char")
- rs.setBundledOutput(wire,0)
- if p1=="a" then
- Play("c1")
- elseif p1=="s" then
- Play("d")
- elseif p1=="d" then
- Play("e")
- elseif p1=="f" then
- Play("f")
- elseif p1=="g" then
- Play("g")
- elseif p1=="h" then
- Play("a")
- elseif p1=="j" then
- Play("h")
- elseif p1=="k" then
- Play("c2")
- elseif p1=="w" then
- Play("c1#")
- elseif p1=="e" then
- Play("d#")
- elseif p1=="t" then
- Play("f#")
- elseif p1=="y" then
- Play("g#")
- elseif p1=="u" then
- Play("a#")
- elseif p1==" " then
- Exit()
- else
- Keys()
- end
- end
- function Exit()
- print("Bye!")
- error()
- end
- function Play(note)
- local output=0
- if note=="c1" then
- output=colors.white
- elseif note=="d" then
- output=colors.orange
- elseif note=="e" then
- output=colors.magenta
- elseif note=="f" then
- output=colors.lightBlue
- elseif note=="g" then
- output=colors.yellow
- elseif note=="a" then
- output=colors.lime
- elseif note=="h" then
- output=colors.pink
- elseif note=="c2" then
- output=colors.gray
- elseif note=="c1#" then
- output=colors.lightGray
- elseif note=="d#" then
- output=colors.cyan
- elseif note=="f#" then
- output=colors.purple
- elseif note=="g#" then
- output=colors.blue
- elseif note=="a#" then
- output=colors.brown
- end
- rs.setBundledOutput(wire,output)
- Keys()
- end
- Main()
Advertisement
Add Comment
Please, Sign In to add comment