Tool Ren'Py Name Replacement Template

BupoTiling03-Retired

Well-Known Member
Modder
Jul 21, 2018
1,314
1,772
I am quite tired of being asked to provide the same Ren'Py tools time and again to random people. I've decided to write up a small template script for changing character names and name dialogue in an easy and manageable way:

It works by hooking (intercepting) the say_menu_text_filter function and then checking a pre-specified dictionary of character names and their intended replacements. Whenever a Character say is run, it runs the hooking function to replace names in the dialogue.

This version however also has the ability to rename characters. The first stub on launch will replace character names for any defined characters, then it installs the hook functionality. If you use it with a game that dynamically defines characters, edit runOnlyOnce to True instead. This way it'll run on each character say. But don't worry, performance shouldn't be hindered much at all, I used the store object to look for characters instead of globals.

Some characters have the same name, such as random body-guards/henchmen/red-shirts, that you might be lost in their dialogue if their text is the same. The function would not be able to tell who is who from that.

This is a best-effort kind of script. The real weight should lie with authors/developers if you want something nicer.

Quite exhausted when I wrote this. Should be fine. Edit: I knew it wouldn't take long for someone to not know how to use it. For Ren'Py things, it'd go under ./game/. Edit: I might update the regex to try to handle stutters (such as “N...Name”) or drawn-out names (such as “Naaaame”).

Credit where due, thanks.
You don't have permission to view the spoiler content. Log in or register now.
Edit: I added a small bit of patching to handle some developers who do stupid things, such as using “re” for character variables. There was originally a conflict if a variable had that name.
 
Last edited: