About This File

Description

This contains a little tool called CaseReplace that I whipped up because I got tired of using search & replace with different letter cases when renaming characters for Don't Starve.
It runs a search & replace process, replacing one name with another in all the relevant files while preserving case (so, for example, "oldname" will become "newname" while "OLDNAME" will become "NEWNAME").
It also renames all the files and directories accordingly (this can be turned on or off).

I bundled a batch file named RenameDSCharacter with it which runs the script using the parameters you would normally need in order to make the replacements for a standard Don't Starve character (it basically searches everywhere except zip files).

IMPORTANT NOTE

This tool performs a simple search & replace. It doesn't know that you only want to change text when it's referring to a character name.
Therefore the name you replace needs to be unique and only appear when as the name of that character!
If your character is named "e" and you run this tool to replace "e" with "a" you'll most certainly break your mod and nothing will work.
Also, this tool has no undo option (replacing "a" with "e" won't undo it), so it's highly recommended you back your files up before using it.
I have tested it but not rigorously, so it's best to make a backup before running this.
I will not be held responsible for the loss of your work or data as a result of using this tool.

Usage

You need Python 3 to use them, so if you don't have it and you want to use this tool, go get it.
I was using Python 3.6.6 when I made it but it's probably OK to use any version of Python 3.

To use it, first extract it into your mod folder.
Now you have two options:

  1. Double-click the file called RenameDSCharacter.bat and when prompted enter the name of the character you want to replace followed by the new name you want it to have (it asks you for those two; just follow the instructions).
  2. Run RenameDSCharacter.bat from command prompt and give it the current name and the new name as parameters (in that order).

If you really want to, or if there's a problem making it get to the right files or something, you can also use the CaseReplace script directly.
To do that, go to the folder in command prompt and type "python CaseReplace.py" (no quotes) followed by the parameters you want.
You can run "python CaseReplace.py --help" to see a list of parameters 

Enjoy your modding. =)




User Feedback

Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now