Page 1 of 1

Help With Hover displayText & Custom Char Names

Posted: Thu Sep 08, 2022 7:36 am
by bDunks
I have created custom names for characters & some hovers with the displayText.
hovered Show("displayTextScreen", displayText = "[m1_name]")

If I do this as shown above, it displays the name literally. [m1_name]
If I remove the quotes & brackets, it works.

However, it fails when using multiple words as well as 's.
hovered Show("displayTextScreen", displayText = m1_name's Car)

I have tried multiple things & I just can't get it to work.
If you can help, I would appreciate it.
Thank you for your time. :)

Re: Help With Hover displayText & Custom Char Names

Posted: Thu Sep 08, 2022 2:27 pm
by Alex
bDunks wrote:
Thu Sep 08, 2022 7:36 am
...
"[m1_name]" - this is the Ren'Py-style data interpolation.
https://www.renpy.org/doc/html/text.htm ... ating-data

But in your case the python-style text formatting is required, so try it like

Code: Select all

# m1_name is the variable, so it doesn't need quotes
Show("displayTextScreen", displayText = m1_name)

Show("displayTextScreen", displayText = "{} - {}".format(m1_name, m2_name) )
Show("displayTextScreen", displayText = "{}'s Car".format(m1_name) )
Show("displayTextScreen", displayText = '{}\'s Car'.format(m1_name) )
https://docs.python.org/3/library/stri ... t-examples
https://www.renpy.org/doc/html/text.htm ... characters

Re: Help With Hover displayText & Custom Char Names

Posted: Fri Sep 09, 2022 5:18 am
by bDunks
Alex

Thank you so much for answering my question. I never learned to code, only pick up bits & pieces here & there until I get some sort of Frankenstein of what I want to work, ha ha.

I used this one here:

Code: Select all

Show("displayTextScreen", displayText = "{}'s Car".format(m1_name) )
I was dismayed when it came back with an error.
Well, that's because I wondered if it should look like this:

Code: Select all

Show("displayTextScreen", displayText = "{m1_name}'s Car".format(m1_name) )
I tried it straight, the way you showed, & it worked!
Thanks again. Take care. :)