- Oct 1, 2020
- 882
- 619
Nope, I was not mistaken... I also was surprised at first to see curly braces instead of square brackets in the code when my replacement didn't work.I assume you've mistaken curly braces ("{") for square brackets ("[")? Because the first are used for text styling and the second for variables.
If I understand correctly you want to be able the replace the result of a variable?
So if we have a variableplayer
= "FaceCrap", then you would want "Hello [player]!" to also match "Hello FaceCrap!"?
They DO work as variables though, but their effect is that the value they derive to is also formatted differently from the rest of the dialogue.
In this case, every time certain characters are mentioned in a dialogue line, the name is shown in the color assigned to that character's name.
They are what renpy calls
config.self_closing_custom_text_tags
In this game it's used like the below snippet.
Python:
def cc_tag2(tag, argument):
char = renpy.eval_who(tag) # Note the use of tag instead of argument
col = char.who_args['color']
if persistent.name_colors:
return [(renpy.TEXT_TAG, u"color={}".format(col)), (renpy.TEXT_TEXT, u"{}".format(char)), (renpy.TEXT_TAG, u"/color".format(col)),]
return [(renpy.TEXT_TAG, u"color={}".format(persistent.set_txt_color)), (renpy.TEXT_TEXT, u"{}".format(char)), (renpy.TEXT_TAG, u"/color".format(persistent.set_txt_color)),]
config.self_closing_custom_text_tags["ro"] = cc_tag2
See below extract.
You don't have permission to view the spoiler content.
Log in or register now.
You're also mistaken in what I wanted. I do NOT want to REPLACE the result of the variable. I want to SEE the actual variable itself in the list of 'Renaming' entries.
NOT what they evaluate to, so like in the below mockup.
The same would apply if a variable is used with square brackets. After all, if you revisit the same game months later, you will not remember if or which displayed entries have variables in either the original or the replacement entry.
PS. My apologies for the usage of all-caps words, I feel they better convey emphasis than just bold. They are not meant as shouting.
Last edited: