Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Music/song player v3
- --Made with some help from freak
- -- Dangranos helped with v2, which this is
- -- based off
- -- All of this made (An re-wrote) by
- -- Luker (luker2009)
- args = {...}
- side = args[2] or "bottom"
- run = true
- if args[1] == nil then
- print("Please put a file to play!")
- run = false
- else
- file = args[1]
- end
- inb = peripheral.wrap(side)
- counter = fs.open(file, "r")
- count = 1
- linec = counter.readLine()
- while linec do
- linec = counter.readLine()
- count = count +1
- end
- lines = count
- a = 0
- song = fs.open(file, "r")
- for i = 1, lines do
- a = a+1
- if a == 1 then
- instr = tonumber(song.readLine())
- elseif a == 2 then
- note = tonumber(song.readLine())
- else
- wait = tonumber(song.readLine())
- sleep(wait)
- inb.playNote(instr,note)
- a = 0
- end
- end
- song.close()
Advertisement
Add Comment
Please, Sign In to add comment