GUI Questions [Solved]

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
justloveme94
Newbie
Posts: 20
Joined: Sat Nov 18, 2017 11:07 pm
Contact:

GUI Questions [Solved]

#1 Post by justloveme94 »

Hello everyone! Hopefully just a quick couple of questions surrounding the GUI.

1. I know how I can change the coloring of a character's name, but I was hoping to change the namebox's color depending on which character was speaking. I replaced the default namebox and it works, but I cannot figure out how to change it for each character.
2. I was also trying to implement a click to continue button for dialogue using a fixed icon. I have the icon appearing on screen but clicking anywhere or hitting enter, still progresses dialogue. Do I have to turn something off for the ctc to work?

Thanks for the help!
Last edited by justloveme94 on Sun Dec 04, 2022 2:28 pm, edited 1 time in total.

User avatar
Kaji
Regular
Posts: 87
Joined: Thu Nov 17, 2022 10:17 pm
Github: Kaji01
Discord: Kaji#7767
Contact:

Re: GUI Questions

#2 Post by Kaji »

Looking in the documentation, I see a couple different options that could be relevant when setting up the Character() call.

I don't have time to run tests right now, but here are the areas to look at on there and try out:
  • Changing Name Display dynamic: If true, then name should either be a string containing a Python expression, a function, or a callable object. If it's a string, That string will be evaluated before each line of dialogue, and the result used as the name of the character. Otherwise, the function or callable object will be called with no arguments before each line of dialogue, and the return value of the call will be used as the name of the character.
  • Click-to-continue: A click-to-continue indicator is displayed once all the text has finished displaying, to prompt the user to advance.
In short, the Dynamic Name Display looks like it would allow you to submit a python block to generate the Namebox, and the Click-to-Continue options provide a lot of fine-grained control over things. From my best guess they would be submitted as a dictionary to the Character() call, something like so:

Code: Select all

atts = {
	"dynamic": True,
	"ctc": True,
}

my_custom_character = Character(name_generation_function(), None, atts)
Hope that helps!

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: GUI Questions

#3 Post by _ticlock_ »

justloveme94 wrote: Sat Dec 03, 2022 1:03 pm 1. I know how I can change the coloring of a character's name, but I was hoping to change the namebox's color depending on which character was speaking. I replaced the default namebox and it works, but I cannot figure out how to change it for each character.
2. I was also trying to implement a click to continue button for dialogue using a fixed icon. I have the icon appearing on screen but clicking anywhere or hitting enter, still progresses dialogue. Do I have to turn something off for the ctc to work?
1)
Setting config.character_id_prefixes makes it possible to style other displayables as well. For example, when the default GUI is used, styles prefixed with namebox_ are used to style the name of the speaking character.
Example:

Code: Select all

style namebox2 is namebox
style namebox2:
    background Frame("#f008", gui.namebox_borders, tile=gui.namebox_tile, xalign=gui.name_xalign)
    
define c = Character("Some_character", namebox_style = 'namebox2')
2) Having ctc does not suppress the default behavior of say screen progressing. It is used as an indicator. Also, I don't recommend restricting players from progressing this way, unless for a short period of time for a specific reason.

User avatar
justloveme94
Newbie
Posts: 20
Joined: Sat Nov 18, 2017 11:07 pm
Contact:

Re: GUI Questions

#4 Post by justloveme94 »

Thank you so much, that worked! Each name box is now changing with each different character. I see what you mean about the ctc. I thought it also controlled clicking. Either way, the ctc at the end of the dialogue box is aesthetically pleasing so I will keep it. Thanks again!

Post Reply

Who is online

Users browsing this forum: Amazon [Bot]