Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- commands = {}
- channel = 65535
- modem = {}
- commands.sides = {
- [1] = "left",
- [2] = "right",
- [3] = "back",
- [4] = "front",
- [5] = "top",
- ["left"] = 1,
- ["right"] = 2,
- ["back"] = 3,
- ["front"] = 4,
- ["top"] = 5
- }
- commands.noteblock = {}
- commands.ints = {
- [0] = "note.harp",
- [1] = "note.bd",
- [2] = "note.snare",
- [3] = "note.hat",
- [4] = "note.bassattack"
- }
- for i=1,4 do
- modem[i] = peripheral.wrap(commands.sides[i])
- modem[i].open(channel)
- commands[i] = {}
- commands.noteblock[i] = {}
- commands[i].execAsync = function(cmd)
- modem[i].transmit(channel, channel, cmd)
- return {}
- end
- commands[i].exec = commands.execAsync
- commands.noteblock[i].playNote = function(int, note)
- int = commands.ints[int]
- note = math.pow(2, (note-12) / 12)
- commands[i].execAsync("playsound "..int.." @a ~ ~ ~ 1 "..note)
- end
- end
- peripheral.nwrap = function(side)
- return commands.noteblock[commands.sides[side]]
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement