[RESOLVED] How to keep namebox from flashing during transition?

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
Black Cat 2412
Regular
Posts: 74
Joined: Wed Aug 16, 2017 10:10 am
Projects: Rapunzel: A classic retold
Deviantart: BlackCat2412
Location: Vietnam
Contact:

[RESOLVED] How to keep namebox from flashing during transition?

#1 Post by Black Cat 2412 »

Good day.

My chracter's namebox keeps flashing (disappear then reappear) whenever transition happen (either because of a say statement or a show statement). Can someone tell me how to keep the namebox on the screen during transition?
Here is my script code:

Code: Select all

define c = Character("Cecillia", color="#FF8C00", image="c", what_prefix='"', what_suffix='"', who_suffix=':')
define w = Character("Will",color="#0000CD", what_prefix='"', what_suffix='"', who_suffix=':')

#Define trasition
define config.say_attribute_transition = Dissolve(0.25)
define fd = Dissolve (0.25)

label start:
    scene bg1 with fade  
    show c normal at left
    
    c "Line of dialogue 1"   
    c smile "Line of dialouge 2"  # <=== the namebox would flash here bc of the transition
   
    show will normal with fd   #<=== it would flash here as well
    w "Line of dialouge 3"
And just in case, here is the code for the namebox and the dialouge box:

Code: Select all

define gui.textbox_height = 175
define gui.textbox_yalign = 0.95

define gui.name_xpos = 405
define gui.name_ypos = -80
define gui.name_xalign = 0.5

define gui.namebox_width = 200
define gui.namebox_height = None

define gui.namebox_borders = Borders(5, 5, 5, 5)

define gui.namebox_tile = False

define gui.dialogue_xpos = 350
define gui.dialogue_ypos = 5

define gui.dialogue_width = 744
define gui.dialogue_text_xalign = 0.0
I have looked at this:viewtopic.php?f=8&t=34497 but when I tried to put "show_two_window" when defining character renpy just gives me an error message. I also tried " define config.window = show" but it did not work either ==

Thank a lot!
Last edited by Black Cat 2412 on Mon Sep 18, 2017 6:06 am, edited 2 times in total.

User avatar
Black Cat 2412
Regular
Posts: 74
Joined: Wed Aug 16, 2017 10:10 am
Projects: Rapunzel: A classic retold
Deviantart: BlackCat2412
Location: Vietnam
Contact:

Re: How to keep namebox from flashing during transition?

#2 Post by Black Cat 2412 »

Anyone?

On another note: only the name box has this flashing problem, the dialogue window works fine with it original config:

Code: Select all

define config.window = "auto"
I wonder if there is any similar code with the name box ?

User avatar
Black Cat 2412
Regular
Posts: 74
Joined: Wed Aug 16, 2017 10:10 am
Projects: Rapunzel: A classic retold
Deviantart: BlackCat2412
Location: Vietnam
Contact:

Re: How to keep namebox from flashing during transition?

#3 Post by Black Cat 2412 »

Bump! While testing out the game, I realized that this problem (albeit minor) really needs to be solved:

Having the namebox keep flashing to my face every single time a character changes their expression quickly becomes an irritating distraction and it kinda break the immersion of the game. Can anyone help me out on this?

Thank a bunch in advance.

philat
Eileen-Class Veteran
Posts: 1900
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: How to keep namebox from flashing during transition?

#4 Post by philat »

Try simply

Code: Select all

_narrator = Character(" ")
# or
narrator = Character(" ")
Can't be bothered to test, but based on the thread you linked, the solution should be somewhere along those lines.

User avatar
Black Cat 2412
Regular
Posts: 74
Joined: Wed Aug 16, 2017 10:10 am
Projects: Rapunzel: A classic retold
Deviantart: BlackCat2412
Location: Vietnam
Contact:

Re: How to keep namebox from flashing during transition?

#5 Post by Black Cat 2412 »

You mean like this? (Sorry if I got it wrong)

Code: Select all

define _c = Character("Cecillia", color="#FF8C00", image="c", what_prefix='"', what_suffix='"', who_suffix=':')
define _w = Character("Will",color="#0000CD", what_prefix='"', what_suffix='"', who_suffix=':')

#Define trasition
define config.say_attribute_transition = Dissolve(0.25)
define fd = Dissolve (0.25)

label start:
    scene bg1 with fade  
    show c normal at left
    
    _c "Line of dialogue 1"   
    _c smile "Line of dialouge 2" 
   
    show will normal with fd   
    _w "Line of dialouge 3"
It simply does not have any effect at all: the problem persists.

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: How to keep namebox from flashing during transition?

#6 Post by Divona »

I believe philat meant it like this:

Code: Select all

define narrator = Character("  ")  # Two spaces. Namebox always on.

define _c = Character("Cecillia", color="#FF8C00", image="c", what_prefix='"', what_suffix='"', who_suffix=':')
define _w = Character("Will",color="#0000CD", what_prefix='"', what_suffix='"', who_suffix=':')

#Define trasition
define config.say_attribute_transition = Dissolve(0.25)
define fd = Dissolve (0.25)

label start:
    scene bg1 with fade  
    show c normal at left
    
    _c "Line of dialogue 1"   
    _c smile "Line of dialouge 2" 
   
    show will normal with fd   
    _w "Line of dialouge 3"
For more information on "narrator" variable, see the documentation.
Completed:
Image

User avatar
Black Cat 2412
Regular
Posts: 74
Joined: Wed Aug 16, 2017 10:10 am
Projects: Rapunzel: A classic retold
Deviantart: BlackCat2412
Location: Vietnam
Contact:

Re: How to keep namebox from flashing during transition?

#7 Post by Black Cat 2412 »

Thank, it indeed helps keep the namebox on the screen, but:
1. I now cannot use

Code: Select all

define gui.namebox_width = None
define gui.namebox_height = None
to automatically resize the namebox's length anymore, as for a split of a second the namebox will just scale to the shortest length (as there is no name for it) and then back to normal. But I consider this to be unimportant (since I can just make the namebox size fixed) compared to the one below:

2. The name box stay on the screen, but not the text itself (this happens to both character name text and dialogue text), it like this:

Code: Select all

define narrator = Character("  ") 

define c = Character("Cecillia", color="#FF8C00", image="c", what_prefix='"', what_suffix='"', who_suffix=':')
define w = Character("Will",color="#0000CD", what_prefix='"', what_suffix='"', who_suffix=':')

#Define trasition
define config.say_attribute_transition = Dissolve(0.25)
define fd = Dissolve (0.25)

label start:
    scene bg1 with fade  
    show c normal at left
    
    c "Line of dialogue 1"   
    c smile "Line of dialouge 2" # <===  For 0.25 sec when the transition is happening, all the text in the dialouge box and the name box disappear.
                                 #Only when the transition finishes do the text "Line of dialogue 2" and the char's name appear. 
                                 #I want it to appear right away-before the transition begins 
                                 #in another word: text stay on screen all the time, even during transition
   
                                 
    show will normal with fd    # <===== Same thing happen here.
    w "Line of dialouge 3"
To illustrate, the effect I want to achieve is like in the game "Wanted: dragon". In that game, characters use dissolve transition to change expression, but while that happens the textbox and the text in it never disppears at all-they appear normally like no transition is taking place.

Thank you for helping me so far and sorry for pestering you guy this much.

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: How to keep namebox from flashing during transition?

#8 Post by Divona »

It's a tough one, as Ren'Py inner does the switch from character to narrator during the transition. The workaround I can think of is to keep "who" variable inside "screen say" as a separate variable, then create another screen to show that name. If the "who" is None, keep the previous name in variable. You will have to manually hide it when you don't want the name to show in the script.
Completed:
Image

User avatar
Black Cat 2412
Regular
Posts: 74
Joined: Wed Aug 16, 2017 10:10 am
Projects: Rapunzel: A classic retold
Deviantart: BlackCat2412
Location: Vietnam
Contact:

Re: How to keep namebox from flashing during transition?

#9 Post by Black Cat 2412 »

Alright, while digging through the documentation I found this :
define config.window_auto_show = [ 'say' ]

A list of statements that cause window auto to show the empty dialogue window.
and this:
define config.empty_window = ...

This is called when _window is True, and no window has been shown on the screen. (That is, no call to renpy.shown_window() has occurred.) It's expected to show an empty window on the screen, and return without causing an interaction.

The default implementation of this uses the narrator character to display a blank line without interacting.
So (if I get it correctly), by default when a transition occurs, an empty window of the narrator character is displayed.
That means now I only need to know how to make this empty window to use the character who will speak next. The problem is: since there is no code sample I have no idea how to make that happen : ) Any suggestion?

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: How to keep namebox from flashing during transition?

#10 Post by Divona »

OK. I have a quick workaround for you.

Code: Select all

default say_who = ""

define narrator = Character("[say_who]")

screen say(who, what):
    style_prefix "say"

    on "show" action If(who != None, true=SetVariable("say_who", who))

    . . .
Make sure you reset "say_who" variable to "" when you don't want any name showing.

Code: Select all

label start:
    scene bg1 with fade  
    show c normal at left
    
    c "Line of dialogue 1"   
    c smile "Line of dialouge 2"
   
    show will normal with fd
    w "Line of dialouge 3"
    
    # Reset
    $ say_who = ""
    
    "Narration 1"
    "Narration 2"
    
    w "Line of dialogue 4"
If you're curious about "config.empty_window" method, then, here is an example. It's not quite work as expected, however.

Code: Select all

init python:

    def create_say_who_variables():
        global say_who
        global last_who
        
        say_who = ""
        last_who = ""
        
    create_say_who_variables()
    
    def say_who_last()
        global say_who
        global last_who
        
        who = _last_say_who
        
        if who is not None:
            who = eval(who)
            say_who = who
            
        if who is None:
            say_who = last_who
            
        last_who = say_who
        
        store.narrator("", interact=False)
        
    config.empty_window = say_who_last
    
define narrator = Character("[say_who]")
Completed:
Image

User avatar
Black Cat 2412
Regular
Posts: 74
Joined: Wed Aug 16, 2017 10:10 am
Projects: Rapunzel: A classic retold
Deviantart: BlackCat2412
Location: Vietnam
Contact:

Re: How to keep namebox from flashing during transition?

#11 Post by Black Cat 2412 »

Thank you so much for your response.

Method one kinda works as now the character name will stay on the screen- but only that, not the dialouge text itself (also, the name lost all of the color and font effects applied to it). I have not tested out method two yet.

But by this point, this problem have been going on for too long without a really effective solution. So I think that perharps currently there is no way to do this properly with the say statement, and why not try using ATL instead as a work around? and it worked!

Here's how I do it:

Code: Select all

define c = Character("Name", color="#FF8C00", image="char")
define fd = Dissolve(0.3, alpha=True, time_warp=None) #It said that alpha=False is more efficient, but if I do that then there is this weird black box appears during the trans

## Now, to the ATL part: I make an ATL image for every change in character's expression
image char n_s: #This one is for transition from normal to smile
    "char normal.png"
    "char smile.png" with fd
    
label start:
show char normal at left
c "Now I'm not smiling"
show char n_s
c "but now I am! And it was done was a transition"
This so far work perfectly: No textbox/namebox/text flashing, and since I don't use the narrator I now can use "define gui.namebox_width = None" again to automatically size the namebox

The obvious disadvantage I can think of is apparently the huge amount of images and codes I have to define for every character, which lead to some worries about potential CPU usage (though I don't even know if that's a real problem or not)

Anyhow, thank you all for following this thread and as of now, I consider this problem to be resolved.

Post Reply

Who is online

Users browsing this forum: Google [Bot]