Changing the say window when showing a CG

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
thirstyoctopus
Regular
Posts: 72
Joined: Mon Aug 27, 2018 12:04 pm
Projects: Romance Visual Novel story
Organization: Thirsty Octopus
Contact:

Changing the say window when showing a CG

#1 Post by thirstyoctopus » Tue Jun 04, 2019 3:22 pm

Hey everyone

I'm having trouble trying to figure out how to alter the dialogue window and namebox at certain points in the game. Whenever there is a CG showing I'd like to change the say window to a slightly transparent version so the player can see the CG better, as the regular say window is solid colour.

I tried playing around in screens.rpy and used a variable called 'is_showing_cg' and switched it from False to True whenever a CG is showing in the game so that say screen would adopt a different style, but it hasn't worked.

This is what I tried:

Code: Select all

if is_showing_cg == True:
    style window is cg_window
else:
    style window is default
Then, in addition to the regular window style declarations, I added cg_window:

Code: Select all

style cg_window:
    xalign 0.5
    xfill True
    yalign gui.textbox_yalign
    ysize gui.textbox_height

    background Image("gui/textbox-cg.png", xalign=0.5, yalign=1.0)
which essentially is the same, except the background image is different. This didn't work so I tried defining it explicitly in the say() screen:

Code: Select all

if is_showing_cg == True:
    id "cg_window"
else:
    id "window"
And unfortunately this didn't work either. I'm not sure if it's because I'm not addressing the issue correctly or it's that the screens.rpy file can't read the variable change (I'm defining it in my definitions.rpy file as False by default) but either way, if someone could shed some light on how this is achievable I'd be grateful - I don't want to have to change my entire GUI to use the transparent say window just for the sake of the few CGs I have in the game.

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Changing the say window when showing a CG

#2 Post by Per K Grok » Tue Jun 04, 2019 5:10 pm

thirstyoctopus wrote:
Tue Jun 04, 2019 3:22 pm
Hey everyone

I'm having trouble trying to figure out how to alter the dialogue window and namebox at certain points in the game. Whenever there is a CG showing I'd like to change the say window to a slightly transparent version so the player can see the CG better, as the regular say window is solid colour.


One way you could do this is by defining two characters for each character that would need two different backgrounds for the dialog window.

define P1 = Character ("Paul", - etc-)
define P2 = Character ("Paul", - etc-, window_background="gui/textbox2.png")

Everything the same except the background. Using P1 when ordinary say window should be used and P2 when you need the special background.

Don't know if it is the best way, but it is at least A way.

User avatar
thirstyoctopus
Regular
Posts: 72
Joined: Mon Aug 27, 2018 12:04 pm
Projects: Romance Visual Novel story
Organization: Thirsty Octopus
Contact:

Re: Changing the say window when showing a CG

#3 Post by thirstyoctopus » Tue Jun 04, 2019 5:18 pm

Per K Grok wrote:
Tue Jun 04, 2019 5:10 pm
thirstyoctopus wrote:
Tue Jun 04, 2019 3:22 pm
Hey everyone

I'm having trouble trying to figure out how to alter the dialogue window and namebox at certain points in the game. Whenever there is a CG showing I'd like to change the say window to a slightly transparent version so the player can see the CG better, as the regular say window is solid colour.


One way you could do this is by defining two characters for each character that would need two different backgrounds for the dialog window.

define P1 = Character ("Paul", - etc-)
define P2 = Character ("Paul", - etc-, window_background="gui/textbox2.png")

Everything the same except the background. Using P1 when ordinary say window should be used and P2 when you need the special background.

Don't know if it is the best way, but it is at least A way.
Hm, that's not a bad idea - but when the CG is on-screen, there is narrative too, so how would I be able to define two different textboxes for narrator? Or I guess I could just hide the namebox and leave the name blank...?

drKlauz
Veteran
Posts: 237
Joined: Mon Oct 12, 2015 3:04 pm
Contact:

Re: Changing the say window when showing a CG

#4 Post by drKlauz » Tue Jun 04, 2019 5:31 pm

I would edit "say" window so it checks if cg image is currently showing. If yes, use different background or apply alpha.
You can get currently shown images by calling renpy.get_showing_tags(). Call you cg images with some prefix, like "cg_king_2", and check if there is tag starting with "cg_".
I may be available for hire, check my thread: viewtopic.php?f=66&t=51350

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]