I was tired of mucking about with winmerge every time a new version came out, and possibly undoing changes to the raws from patches, so I wrote a simple little tool in python to look for animal men in your raws and remove them. I call it.. CULLMENS.
GET IT HERE ->
http://dffd.wimbli.com/file.php?id=6305INSTRUCTIONS:
IF YOU HAVE PYTHON:
-move cullmens.py into your raw/objects folder
-double-click it
-review and MOVE OR DELETE CULLINGLOG.txt (may cause hilarious duplicated raw errors if you don't!)
-you can throw away cullmens.py now if you want.
-enjoy!
IF YOU DO NOT HAVE PYTHON (AND I PRESUME YOU ARE ON WINDOWS):
-copy the CONTENTS of your raw/objects folder into the CULLMENS/WINDOWS folder.
-double-click cullmens.exe
-review and MOVE OR DELETE CULLINGLOG.txt (may cause hilarious duplicated raw errors if you don't!)
-move your raw files back into your raw/objects folder.
-enjoy!
COMPLETE PYTHON SOURCE FOR YOUR PERUSAL:
import re
import os
creatureraw = re.compile(r"creature_.+\.txt", re.DOTALL)
mantag = re.compile(r"\[CREATURE:.+MAN\]\n", re.DOTALL)
indentedtag = re.compile(r"\t+\[.*\]\n")
newline = re.compile(r"\n")
visiblefiles = os.listdir(os.getcwd())
targetraws = []
logfile = open("CULLINGLOG.txt", "w")
for currentfile in visiblefiles:
if (creatureraw.match(currentfile)):
logfile.write("file " + currentfile + " <--CREATURE RAW FOUND\n")
targetraws.append(currentfile)
else:
logfile.write("file " + currentfile + "\n")
logfile.write("\nBEGINNING CULL..\n")
for currentrawname in targetraws:
logfile.write("SEARCHING FILE: " + currentrawname + "\n")
rawfile = open(currentrawname, "r")
lines = rawfile.readlines()
prunedlines = []
culling = False
for line in lines:
if (not culling):
if (mantag.match(line)):
logfile.write("CULLING:\n")
logfile.write(line)
culling = True
else:
prunedlines.append(line)
else:
if (indentedtag.match(line)):
logfile.write(line)
elif (newline.match(line)):
culling = False
rawfile = open(currentrawname, "w")
for line in prunedlines:
rawfile.write(line)
It will record all the changes it makes in a file called CULLINGLOG.txt, which you should review after the tool runs, and probably delete or move it out of the folder, lest it create unintentional fun times.
It's really simple at this point, and it would be easy for me to program it to be interactive- (do you want to keep penguin men? swallow men? hippo men?), or just move all the animal men entries to their own raw file, or whatever, if there's interest. All feedback and suggestions are welcome!
Also, as someone who's never put code on the internet before, what should I put at the top of source files? I see people put big blocks of legit-looking copyright claim and stuff at the top of their files, but how does that work? Do I need to do anything special to claim copyright for source files? What should I put up there? Would the GPL be better?
THANKS.