- Jun 10, 2017
- 10,971
- 16,228
The question start to be recurrent: I'm making a game with Ren'py, and I want to help the creation of a patch letting me easily change the way characters are named.
There's more than one solution, but most of them come with their cons. Among them you can :
Here I'll propose you another approach of the problem. One which is more dynamics and probably easier to use. All the process is based on the use of a generic Python class and the dynamic text inclusion of Ren'py.
It works in three steps :
It's not clearly seen in the example, but you aren't limited to "formal", "informal" and "fullFormal". You can use the names you want and define as many as you want. Plus, if you put the first letter of this "name" in upper case, the text returned will also have it's first letter in upper case. So, by just writing this :
You'll be able to have in your game both, mNames.fullFormal, which will return "my teacher", and mNames.FullFormal, which will return "My teacher". All this without any need to define it twice.
Now, you are ready to make your game using fully dynamics names, with a lot of names, or sentences, depending of the context. Then, with a single file and without editing a single line of your own code, anyone will be able to patch your game and change these "fully dynamics names".
But here come a problem. You are a good writer, there's a lot of things to change and it will make a really big line to write behind "mNames = DynamicNames(". Therefore, I made the works for you...
Attached to this message, you'll find an archive. In this archive you'll find a "script.rpy" file as example, and a file named "00DynamicNames.rpy", to put in your "[project name]\game" folder among all your game's code. This file will add the "defineDynamicName" and "define_dynamic_name" statements to Ren'py language. Use the one you prefer and write things like this :
Like above, anyone will be able to patch your game just by writing a "patch.rpy" file which will have these "defineDynamicName" statements at an higher init level.
It will use the advanced class I've shown above, with a bonus side. You can now easily extend it by adding a line in the "dynamicName" block:
Now, Laura have a new dynamic string, "mcIs". Repeat each time your writing make you add one thing to change...
In addition, it also add the "dynamicName" and "dynamic_name" statements, to use in a label this time, if you want "mName" and "sName" objects to be saved. But I do NOT recommend you to do this ; it will force the player to restart the game each time you add something.
By keeping the values defined at init time, you'll keep your game up to date, whatever it's a regular version or a patched one, and whatever time have past since the last version played by the player. It will also make it easier for a player to revert to an unpatched version by just removing the patch file.
Note:
Please don't misunderstood me. It appear that my examples make it look like you're trying to create an incest patch to work around the guideline of a certain site. It's obviously not my intent, nor yours, I know it. Who could want to do this kind of things, especially in a pirate site like this one...
If you found this useful, consider giving a like as thanks and/or encouragement to write more.
There's more than one solution, but most of them come with their cons. Among them you can :
- Use the translation feature.
It's simple and all what's needed is already in Ren'py, but it need that you "translate" the whole string, even if there's only one word to change in it. - Use some RegEx to perform string replacement.
It's efficient, but not really simple. Even if you use a list to ease your work, you still have to define each string and their replacement. Plus it can have some weird side effects. If you made an error when writing the RegEx, or if you don't limited it correctly, it can change part of a word, because it looks like the word/sentence you wanted to change.
Here I'll propose you another approach of the problem. One which is more dynamics and probably easier to use. All the process is based on the use of a generic Python class and the dynamic text inclusion of Ren'py.
It works in three steps :
- Define your class :
You don't have permission to view the spoiler content. Log in or register now.You don't have permission to view the spoiler content. Log in or register now. - Create the objects associated to this class :
You'll need one object by character affected by the change. For the example, let's say that you have two characters :
Code:define m = Character( "Laura" ) define s = Character( "Tina" )
You don't have permission to view the spoiler content. Log in or register now.You don't have permission to view the spoiler content. Log in or register now.
You don't have permission to view the spoiler content. Log in or register now.You don't have permission to view the spoiler content. Log in or register now. - Use Ren'py dynamic text inclusion when writing your dialog.
By example, you can have these lines of dialog :
Code:label somePartOfYourGame: "I can't, she's [mNames.fullFormal] !" "[mNames.Informal], come here please." "[sNames.Formal] ? She's [sNames.informal] and [sNames.fullFormal], why ?"
I can't, she's my teacher !
Laura, come here please.
Tina ? She's a buddy and my classmate, why ?
I can't, she's my mother !
Laura, come here please.
Tina ? She's a slut and my sister, why ?
It's not clearly seen in the example, but you aren't limited to "formal", "informal" and "fullFormal". You can use the names you want and define as many as you want. Plus, if you put the first letter of this "name" in upper case, the text returned will also have it's first letter in upper case. So, by just writing this :
Code:
mName = DynamicNames( fullFormal = "my teacher" )
Now, you are ready to make your game using fully dynamics names, with a lot of names, or sentences, depending of the context. Then, with a single file and without editing a single line of your own code, anyone will be able to patch your game and change these "fully dynamics names".
But here come a problem. You are a good writer, there's a lot of things to change and it will make a really big line to write behind "mNames = DynamicNames(". Therefore, I made the works for you...
Attached to this message, you'll find an archive. In this archive you'll find a "script.rpy" file as example, and a file named "00DynamicNames.rpy", to put in your "[project name]\game" folder among all your game's code. This file will add the "defineDynamicName" and "define_dynamic_name" statements to Ren'py language. Use the one you prefer and write things like this :
Code:
init:
defineDynamicName mName:
formal "teacher"
informal mGetName
fullFormal "my teacher"
defineDynamicName sName:
formal sGetName
informal "a budy"
fullFormal "my classmate"
It will use the advanced class I've shown above, with a bonus side. You can now easily extend it by adding a line in the "dynamicName" block:
Code:
init:
defineDynamicName mName:
formal "teacher"
informal mGetName
fullFormal "my teacher"
mcIs "one of my student"
defineDynamicName sName:
formal sGetName
informal "a budy"
fullFormal "my classmate"
In addition, it also add the "dynamicName" and "dynamic_name" statements, to use in a label this time, if you want "mName" and "sName" objects to be saved. But I do NOT recommend you to do this ; it will force the player to restart the game each time you add something.
By keeping the values defined at init time, you'll keep your game up to date, whatever it's a regular version or a patched one, and whatever time have past since the last version played by the player. It will also make it easier for a player to revert to an unpatched version by just removing the patch file.
Note:
Please don't misunderstood me. It appear that my examples make it look like you're trying to create an incest patch to work around the guideline of a certain site. It's obviously not my intent, nor yours, I know it. Who could want to do this kind of things, especially in a pirate site like this one...
If you found this useful, consider giving a like as thanks and/or encouragement to write more.
You don't have permission to view the spoiler content.
Log in or register now.