Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local x,y = term.getSize()
- local cinstru = 0
- local maxnotes = 23
- local instruments = {
- [0] = "piano",
- [1] = "bass",
- [2] = "snare",
- [3] = "clicks",
- [4] = "bass guitar",
- }
- function printGUI()
- term.setBackgroundColour( colors.black )
- term.setTextColour( colors.white )
- term.clear()
- term.setCursorPos(1,1)
- if x ~= 29 then
- print("Instrument: " ..instruments[ cinstru ].. " (Right click to change) " )
- print( string.rep( "-", x ) )
- else
- print( instruments[ cinstru ] )
- print( string.rep( "-", 27 ) )
- end
- term.setCursorPos(1,3)
- write( "|" )
- local color = colors.gray
- for i=0,maxnotes do
- term.setBackgroundColour( color )
- write( " " )
- if color == colors.gray then
- color = colors.lightGray
- else
- color = colors.gray
- end
- end
- term.setBackgroundColour( colors.black )
- if x ~= 29 then
- term.setBackgroundColour( colors.black )
- print( "| Notes: 24" )
- print( string.rep( "-", x ) )
- print( "Program by xXm0dzXx" )
- print( "Requires the following mods: ")
- print( " - MiscPeripherals" )
- print( " - ComputerCraft 1.481+" )
- print( "\nHow to use it:" )
- print( "C = Computer / N = Iron Noteblock" )
- print( "---" )
- print( " N " )
- print( " C " )
- else
- print( "|" )
- print( string.rep( "-", 27 ) )
- end
- while true do
- local event, key, xPos, yPos = os.pullEvent()
- if event == "mouse_click" or event == "mouse_drag" then
- if key == 1 then
- local speaker = peripheral.wrap( "top" )
- if yPos == 3 then
- if xPos ~= 1 then
- note = xPos-1
- if note <= 25 and note ~= 25 then
- speaker.playNote( cinstru, note )
- end
- end
- end
- elseif key == 2 then
- break
- end
- end
- end
- end
- while true do
- for i=0,4 do
- cinstru = i
- printGUI()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment