Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tArgs = { ... }
- if not tArgs[2] then tArgs[2] = tArgs[1] .. ".song" end
- file2 = fs.open(tArgs[2],"a")
- lines = io.lines(tArgs[1])
- print("Target: " .. tArgs[1])
- print("Output: " .. tArgs[2])
- print("Working...")
- term.setTextColor(colours.orange)
- for line in lines do
- if line:find("playNote") then
- a1,a2 = line:find("(",0,true)
- b1,b2 = line:find(",",a2+1,true)
- c1,c2 = line:find(")",a2+1,true)
- if b1 then
- arg1 = line:sub(a2+1,b1-1)
- else
- arg1 = line:sub(a2+1,c1-1)
- end
- if b1 then
- arg2 = line:sub(b2+1,c1-1)
- end
- arg2 = arg2:gsub(" ","")
- if arg2 then
- file2.writeLine("P|" .. arg1 .. "|" .. arg2)
- else
- file2.writeLine("P|" .. arg1)
- end
- elseif line:find("sleep") then
- local a1,a2 = line:find("(",0,true)
- local b1,b2 = line:find(")",0,true)
- local arg1 = line:sub(a2+1,b1-1)
- file2.writeLine("S|" .. arg1)
- end
- end
- term.setTextColor(colours.white)
- print("Done")
- file2.flush()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement