I'll prefix this by saying that while I've got 10 years of Java enterprise experience under my belt, I'm completely new to Python and Ren'Py.
I know that the string interpolation feature in Ren'Py looks in the global store for substitutions, and if I use the global store everything works fine. I've been trying to tidy up the code that I have, and noted from the documentation that there is a character store as well - so I refactored my character definitions to put them into the character store instead. Obviously this means they're no longer in the global store, so now a bunch of the substitutions in the text no longer work.
Having the characters defined in the character store 'feels' (to my inexperienced mind at least) to be the cleaner/correct thing to do, so I'd like to keep the definitions there if possible. Is there some way I can coax Ren'Py into also scanning the character store when interpolating strings?
Alternatively, is there some way I can indicate in the text itself which store the variable I'm trying to reference is located?
[Solved] How can I get string interpolation to also look in the character store?
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
[Solved] How can I get string interpolation to also look in the character store?
Last edited by Anarial on Tue May 19, 2020 6:04 pm, edited 1 time in total.
- Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: How can I get string interpolation to also look in the character store?
You could prefix the namespace in the interpolation
Code: Select all
define character.e = Character("Eileen")
label start:
e "My name is [character.e]"
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
Re: How can I get string interpolation to also look in the character store?
Interesting - I had tried that and the interpolation still didn't seem to be working. I'll give it another go after clearing out all the rpyc files just in case it was using an older version of the script!
EDIT:
Looks like that did the trick! Thank you for the help
EDIT:
Looks like that did the trick! Thank you for the help
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot], Lucyper