[SOLVED] Making the WHO on a say screen a textbutton while keeping its who_color?

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.
Post Reply
Message
Author
User avatar
qirien
Miko-Class Veteran
Posts: 541
Joined: Thu Jul 31, 2003 10:06 pm
Organization: Metasepia Games
Deviantart: qirien
Github: qirien
itch: qirien
Location: New Mexico, USA
Discord: qirien
Contact:

[SOLVED] Making the WHO on a say screen a textbutton while keeping its who_color?

#1 Post by qirien »

I just added a Bios section to my game, where it has a little bio for every character in the game. I want the player to be able to click on the name of anyone speaking and have it jump to their entry in the bio. This part is actually working fine.

However, now that the name of the speaker is a textbutton instead of text, my custom colors that I have setup for each Character no longer work. The color is getting passed to the label part of the name, not the label_text (which is what you need for buttons).

Here's an example character:

Code: Select all

define her = Character("[her_name]", image="her", ctc="ctc_blink", ctc_position="nestled") #light fuschia
While I could set the color inside of each name like this:

Code: Select all

define her = Character("{color=#d1a2b8}[her_name]{/color}", image="her", ctc="ctc_blink", ctc_position="nestled") #light fuschia
then I'd have to change the text passed into the say screen to take out all that stuff before I pass it to the bios screen so it knows which bio to show.

Is there a way to get the who_color out of the character object somehow? Or make a label a button without making it a textbutton so it can continue to use the who_color?
Last edited by qirien on Sat Oct 03, 2020 11:07 am, edited 1 time in total.
Finished games:
Image
Image
Image

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: Making the WHO on a say screen a textbutton while keeping its who_color?

#2 Post by hell_oh_world »

Kinda works for me, maybe i just didn't understand it clearer. But this is how i set it up.

Code: Select all

define mc = Character("mc", who_color="#f00")
screen say(who, what):
  ...
  if who is not None:

            button:
                id "namebox"
                action NullAction() # whatever your action should be when the who is clicked...

                text who:
                    id "who"
                    hover_underline True
  ...
The who color is still showing in this.

User avatar
qirien
Miko-Class Veteran
Posts: 541
Joined: Thu Jul 31, 2003 10:06 pm
Organization: Metasepia Games
Deviantart: qirien
Github: qirien
itch: qirien
Location: New Mexico, USA
Discord: qirien
Contact:

Re: Making the WHO on a say screen a textbutton while keeping its who_color?

#3 Post by qirien »

Thank you, this is exactly what I was trying to do! I didn't know you could use buttons this way (I've only used textbuttons and imagebuttons), but it makes sense (and also helps solve a different problem I had). Many thanks!
Finished games:
Image
Image
Image

Post Reply

Who is online

Users browsing this forum: No registered users