Chip's Challenge Level Splicer - Printable Version +- CC Zone - Chip's Challenge Forum (https://forum.bitbusters.club) +-- Forum: Chip's Challenge (https://forum.bitbusters.club/forum-4.html) +--- Forum: Programs and Editors (https://forum.bitbusters.club/forum-16.html) +--- Thread: Chip's Challenge Level Splicer (/thread-1366.html) |
Chip's Challenge Level Splicer - quiznos00 - 13-Jul-2016 CCLP4 voting is soon upon us, and I thought I'd share the script I wrote to assemble the voting packs. It is available on PasteBin. This Python script takes in an text file consisting of one or more lines of the filename of a level set and a level number, separated by a tab. It outputs a new level set consisting of the specified levels. Hopefully someone else will find it useful, and don't hesitate to ask questions about it Chip's Challenge Level Splicer - M11k4 - 14-Jul-2016 That's great. Could you provide a simple example of the text files? Chip's Challenge Level Splicer - _H_ - 14-Jul-2016 Just had a quick look at the code, the syntax should be Code: file[tab]number but the program has several flaws, it doesn't change the level numbers (so the output will not be correct), for the input it doesn't check for empty lines, so it will try to open a file it can't at the end of file if it is, as in most text files, in it's own line, and crash (just insert something like if pair[0]=="": continue in line 15 to avoid it), and it opens all input files multiple times for no apparent reason... This should work properly: (in Lua) Code: function levels(s) and you can specify multiple levels per set per line and use arbitrary white space as separator. Code: CCLP1.dat 123 2 Chip's Challenge Level Splicer - quiznos00 - 14-Jul-2016 Yeah, there is minimal error checking in the code since it was mainly for personal use. And I believe a level editor will fix the problem of the incorrect level number headers (though a set will play fine even when these are incorrect). Maybe I'll release an update to the code For Miika, here is an example of a ten-level input file (CCZone doesn't support tabs so just imagine the final space is a tab): Josh-CCLP4.dat 60 IHNN1-CCLP4 mix.dat 41 Josh-CCLP4.dat 195 C1059-CCLP4.dat 60 IHNN1-CCLP4 mix.dat 17 Josh-CCLP4.dat 180 IHNN1-CCLP4 mix.dat 160 ZK4 submissions.dat 23 The Other 100 Tiles.dat 71 C1059-CCLP4.dat 34 Chip's Challenge Level Splicer - quiznos00 - 24-Nov-2016 Quote:but the program has several flaws, it doesn't change the level numbers (so the output will not be correct), for the input it doesn't check for empty lines, so it will try to open a file it can't at the end of file if it is, as in most text files, in it's own line, and crash (just insert something like if pair[0]=="": continue in line 15 to avoid it), and it opens all input files multiple times for no apparent reason... Rewrote my script just for kicks. I polished up stuff, the internal level numbers are now correct, input checks for empty lines, and files are only opened/closed once, though this method isn't necessarily more efficient than opening/closing files on a line-by-line basis, especially if you have lots of unique level sets. Added the multiple levels per line option too. Now that all the CCLP4 packs have been assembled and released, I'd have to say the first script I wrote worked fine I kept the tab separation between the filename and level numbers, because some level sets have spaces in their names, unfortunately. |