Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tArgs = {...}
- function px(x,y,c)
- paintutils.drawFilledBox(x,y,x,y,c)
- end
- speed = 1 -- Dont change this
- if not fs.exists(tArgs[1]) then error("Doesnt exist") end
- if peripheral.find("monitor") then term.redirect(peripheral.find("monitor")) end
- colour = {colours.blue,colours.orange,colours.cyan,colours.lightGrey,colours.green,colours.purple}
- title = tArgs[2] or tArgs[1]
- offsets = {0, -2, -1, -3, -4}
- size = {term.getSize()}
- nb = peripheral.find("Music") or peripheral.find("minecraft:noteblock") or peripheral.find("speaker")
- if not nb then
- if peripheral.find("neuralInterface") then
- if peripheral.find("neuralInterface").playNote then
- nb = peripheral.find("neuralInterface")
- end
- end
- end
- if ( not nb ) or ( not nb.playNote ) then error("Noteblock with playNote method required or neuralInterface with noteblock as module") end
- term.setCursorPos(1,size[2]/2)
- term.setTextColor(colours.cyan)
- term.setBackgroundColor(colours.black)
- term.clear()
- print(string.rep("-",size[1]))
- print()
- print(string.rep("-",size[1]))
- term.setCursorPos(2,(size[2]/2)+1)
- term.write(title)
- sleep(2)
- exec = true
- parallel.waitForAll(function()
- for line in io.lines(tArgs[1]) do
- --print(line)
- syntx = line:gmatch("([^|]*)")
- syntax = {}
- for l in syntx do
- table.insert(syntax,l)
- end
- if syntax[1] == "P" then
- arg1 = syntax[3] or 0
- arg2 = syntax[5] or 0
- px(tonumber(arg2) + offsets[tonumber(arg1)+1],size[2]-1,colour[tonumber(arg1)+1])
- term.setBackgroundColor(colours.black)
- --term.setBackgroundColour(colour[tonumber(arg1)+1])
- nb.playNote(tonumber(arg1),tonumber(arg2))
- elseif syntax[1] == "S" then
- arg1 = syntax[3] or 0
- sleep(tonumber(arg1)/speed)
- end
- end
- exec = false
- return
- end,
- function()
- while exec == true do
- os.sleep(0.1)
- term.scroll(1)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement