Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local speaker = peripheral.find('speaker')
- if not speaker then
- error('No speaker found!')
- end
- local list = {
- {'Blocks','music_disc.blocks'},
- {'Cat','music_disc.cat'},
- {'Chirp','music_disc.chirp'},
- {'Far','music_disc.far'},
- {'Mall','music_disc.mall'},
- {'Mellohi','music_disc.mellohi'},
- {'Stal','music_disc.stal'},
- {'Strad','music_disc.strad'},
- {'Wait','music_disc.wait'},
- {'Ward','music_disc.ward'},
- }
- term.clear()
- term.setCursorPos(1,1)
- print('Please input the track to play')
- term.setCursorPos(1,5)
- for i,v in pairs(list) do
- print(' -'..v[1])
- end
- while true do
- term.setCursorPos(1,3)
- term.clearLine()
- term.setCursorPos(1,3)
- local input = read()
- for i,v in pairs(list) do
- if string.lower(v[1]) == string.lower(input) then
- speaker.playSound(v[2],2)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement