Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function iswindows()
- osver = io.popen("ver"):read("*a");
- if string.match(osver, 'Windows') ~= nil then
- return true;
- else
- os.execute("clear");
- end;
- end;
- function clear()
- if iswindows() then
- os.execute("cls");
- else
- os.execute("clear");
- end;
- end;
- repeat
- clear();
- io.write("do you want to convert: "..string.match(arg[1], ".+\\(.-%.sm)").." y/n: ");
- selection = io.read();
- until selection == "y" or selection == "n";
- newline = "";
- newinfo = "";
- if selection == "y" then
- f = io.open(arg[1], "r");
- oldfile = f:read("*all");
- for str in string.gmatch(oldfile, "(#NOTES:.-;)") do
- if string.find(str, "dance%-double") then
- newline = newline.."\n//---------------pump-single - ----------------\n";
- for info in string.gmatch(str, "(#NOTES:.+:)") do
- newinfo = newinfo.."\n\n//---------------pump-single - ----------------\n"
- for infoline in string.gmatch(info, "(.-:)") do
- if string.find(infoline, "double") then
- infoline = "\n pump-single:"
- end;
- newline = newline..infoline;
- newinfo = newinfo..infoline
- end
- end
- newline = newline.."\n";
- for setend in string.gmatch(str, "(.+);") do
- str = setend..",";
- end;
- for line in string.gmatch(str, "(.-)%,") do
- for Left1, Down1, Up1, Right1, Left2, Down2, Up2, Right2 in string.gmatch(line, "(%d)(%d)(%d)(%d)(%d)(%d)(%d)(%d)") do
- Center = Left1;
- DownLeft = Left2;
- if tonumber(Down1) > 0 or tonumber(Down2) > 0 then
- UpLeft = 1;
- else
- UpLeft = 0;
- end;
- if tonumber(Up1) > 0 or tonumber(Up2) > 0 then
- UpRight = 1;
- else
- UpRight = 0;
- end;
- if tonumber(Right1) > 0 or tonumber(Right2) > 0 then
- DownRight = 1;
- else
- DownRight = 0;
- end;
- setline = DownLeft..UpLeft..Center..UpRight..DownRight;
- newline = newline..setline.."\n";
- showdot = true
- end;
- if showdot then
- newline = newline..",\n";
- showdot = false
- end;
- end;
- for fixend in string.gmatch(newline, "(.+)%,") do
- newline = fixend..";\n";
- end;
- end;
- end;
- print(newinfo);
- io.close(f)
- f = io.open(string.match(arg[1], ".+\\(.-%.sm)").."new", "w")
- f:write(oldfile..newline)
- io.close(f)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement