Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
eileen 'Hello [nickname]!"
player "Hi, Eileen!"
eileen "[nickname]! You're always so cheerful, what's you secret?"
In cases where nickname is a proper noun (Bob, for example) this works just fine, however sometimes nickname will not be a proper noun (stranger for a contrived example). In the second replacement I'd like to capitalise the improper noun because it's the start of a sentence, is there anyway to achieve this short of having to maintain two variables and remember to use one at the start of sentences and the other everywhere else? I just know it's going to get confusing with that approach.
Last edited by strayerror on Sun Apr 21, 2019 1:17 pm, edited 1 time in total.
This takes advantage of the fact that having a character say something is equivalent to "calling" the character object with the item to be said. But, IMHO, this is SO ugly that two variables would be preferred. LOL
Of course, there may be a FAR simpler way of doing this that one of the local Ren'py/Python gurus can come up with...
Thanks both, unfortunately say_menu_text_filter is called prior to the substitutions, so that option doesn't quite work
I also realised that this issue is actually far more complex than first though as it really applies to the start of any sentence, even those that start in the middle of a line. Googling around it looks like sentence detection is far from "solved" and can differ significantly between languages, so I fear this isn't as solvable as I'd hoped. Might be that the best I can hope for is adding some sort of annotation [nickname!c] or something for when a capitalised version is desired, if indeed it's possible to add annotations.
You're right, that is a lot more complicated than I'd assumed... Having a capitalized version of the string either thru text tags or a second variable is probably your best bet, then...