Ren'Py Walkthrough mod localization?

Jan 4, 2019
25
70
Hi all,

I'm currently working on my first walkthrough mod, and I've mapped everything and figured out how to restyle specific choices using tags, but the game I'm working on:
  1. is a bit more complex since it has multiple primary and secondary love interests,
  2. wasn't originally coded in English, which is included as a translation.
So what I had in mind was basically something like this:
  • Option A (LI1Path) (LI2Path)
  • Option B (LI3Path)
but even after checking a few other mods, I can't seem to find a way to do that without breaking the translations, which would mean having to edit every single choice as many times as there are languages.

Is that a Ren'Py limitation, or is there a workaround I'm not aware of?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,262
15,062
Is that a Ren'Py limitation, or is there a workaround I'm not aware of?
Well, I'm tempted to answer that there's a whole world you aren't aware of.

Would you be aware of it, you would have worded your question differently, trying to figure where in the code you are, because you would already know that the translation isn't an issue.
What mean that, first, you've to forget everything you did for you walkthrough, and starts to do it correctly.


is called before the texts are processed. This mean that they'll be untranslated, whatever the language selected by the player.
But of course, if you alter the text at that level, Ren'Py will fail to find a translation. Therefore you'll have to do the text substitution and possible translation by yourself through the use of .

Therefore, it will lead to a code looking more or less like that:
Python:
# All the choices and the associated hints.
define choiceToHint = {
    "Pay for her": "(If you want her)",
    "Let her pay": "(Close her route)",
    #"Split the bill": "",   # Not needed since it lead to no changes
    [...] }

init python:

    def csmtf( txt ):
        # It's not a menu entry, or not a covered choice, so do nothing.
        if not txt in choiceToHint:
            return txt

        #  It's a covered choice, so...
        #  translate it, process the tags and process the possible substitutions,
        retVal = renpy.substitute( txt )
        #  add the hint,
        retVal += " " + choiceToHint[txt]
        #  and return the new value.
        return retVal

If there's a lot of choices, relying on will permit to limits the number of entries. It also offer a better control when a choice can appear more than once:
Python:
init python:
    # HiJack the label "whatever" for it to pass by your own code.
    config.label_overrides["whatever"] = "whateverWT"
    config.label_overrides["whateverOUT"] = "whatever"

label whateverWT:
    # Only the choices relevant for that label.
    $ choiceToHint = {
    "Pay for her": "(If you want her)",
    "Let her pay": "(Close her route)",
    [...] }
    # Go back to the regular flow.
    jump whateverOUT

In case choices are too often insignificant ("YES"/"NO") then you'll have to extend a bit.

You can use a list as value for the "choiceToHint" dict, using the first entry, then removing it, to stay synchronized with the menus. But in this case do NOT forget to include the insignificant choice, else you'll lost the synchronization.

But relying on , is a way better approach, because you'll know exactly where you are in the game. It will point to the line where the menu starts, not to the line with the choice, but it don't change much.
This said, there's a constraint. You need to check the game with each update, to ensure that the line number haven't changed, but it's a small issue.
To use it, you'll have to extend the values of the dict. Something like a tuple "( filename, linenumber, hint )" is probably the easiest approach.



Side note:
The fact that you found no walkthrough mod that led you on the right way is highly depressing. Did they ever take a look at the doc at least once ?
And the fact that some of their author have a Patreon page and get money for their lazy job is even more depressing...
 
Jan 4, 2019
25
70
Well hey, I'd much rather look like a complete noob and get pointed in the right direction than be too proud to ask for help and never learn how to do things correctly!

But I have indeed checked a number of walkthrough mods and have yet to find a single "universal" one. Now, to be fair, that doesn't necessarily mean their authors don't know how to do it, it might just not be worth the hassle to them.

Anyway, I'll definitely look into all that and try to make sense of it, thanks!