[Solved] Screen transition not affecting a textbox

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
Lorgan
Newbie
Posts: 5
Joined: Thu Nov 29, 2018 7:53 am
Contact:

[Solved] Screen transition not affecting a textbox

#1 Post by Lorgan »

Hello,

I have a screen used for displaying certain status info in my game. The problem is, whenever I show/hide it with dissolve or any other transition, the text box is disappearing for the duration of that transition. Is it possible to transition just that screen without affecting the text box, nor any other visible element?

Thanks!
Last edited by Lorgan on Sun Dec 02, 2018 8:59 pm, edited 1 time in total.

User avatar
Enchant00
Regular
Posts: 136
Joined: Tue Jan 12, 2016 1:17 am
Contact:

Re: Screen transition not affecting a textbox

#2 Post by Enchant00 »

If it's okay, can you post your code here? I'm not sure how you coded your status screen and how the text window is being affected so it will help a lot if I can see how your screen elements are constructed.

Lorgan
Newbie
Posts: 5
Joined: Thu Nov 29, 2018 7:53 am
Contact:

Re: Screen transition not affecting a textbox

#3 Post by Lorgan »

Sure, here's my code.

Code: Select all

style status_text:
    xalign 0.03
    yalign 0.03

screen StatusScreen():
    image "gui/status.png" xalign 0 yalign 0
    hbox:
        style "status_text"
        text "some text" outlines [ (0, "#00000080", 2, 2) ]

####

a "Some dialogue 1."

hide screen StatusScreen
with dissolve

a "Some dialogue 2."

User avatar
Enchant00
Regular
Posts: 136
Joined: Tue Jan 12, 2016 1:17 am
Contact:

Re: Screen transition not affecting a textbox

#4 Post by Enchant00 »

The easiest way is to separate your StatusScreen() and your text since it appears that your text is subject to change anyway.

Code: Select all

screen StatusScreen_BG():
    image "gui/status.png" xalign 0 yalign 0

screen Stats:
    image "gui/status.png" xalign 0 yalign 0
    hbox:
        style "status_text"
        text "some text" outlines [ (0, "#00000080", 2, 2) ]

###
a "Some dialogue 1."

hide screen Stats
with dissolve

a "Some dialogue 2."
###
The downside to this is that you will need two screen declarations. It's best to combine the StatusScreen_BG with other of your GUI which will not change. In addition, you can't use the renpy screen Use or 'On 'Hide' action With(Dissolve(1.0) on one single screen since you will have to hide the entire thing which would also include the bg.

There is a crude way of doing it and what I tried seems to work, but in the end it will be subject to how you would be using it. You will have to show the text on a different layer of than the screen layer, show using renpy.show_screen('text', _layer = 'custome_layer') hide with the renpy.hide_screen(tag, _layer = 'custom_layer') and manually apply the transition. In the end, you still need to define two seperate screens for that.

Code: Select all

define config.layers = [ 'master', 'transient', 'screens', 'overlay', 'custom']

screen StatusScreen_BG:
    image "images/t.png" xalign 0.5 yalign 0.5
    $renpy.show_screen('text', _layer = 'custom')

screen text:
    tag stat
    hbox:
        xalign 0.5 yalign 0.5
        style "status_text"
        text "some text" outlines [ (0, "#00000080", 2, 2) ]

###
show screen StatusScreen_BG:

a "Some dialogue 1."

$ renpy.hide_screen('stat', layer = 'custom')
$ renpy.transition(Dissolve(1.0))

# You will then have to replace said screen with another text before interaction ends else the old text will return. You can also specify parameter which is up to you.
a "Some dialogue 2."
Another possibility is to turn the text to a displayable and apply a transform to it so in a sense you can put it into a single screen statement. Thi is the only thing I could think of and if anyone else has a solution let me know :lol:

Lorgan
Newbie
Posts: 5
Joined: Thu Nov 29, 2018 7:53 am
Contact:

Re: Screen transition not affecting a textbox

#5 Post by Lorgan »

Ok, I think you misunderstood me a little. What I wanted to keep was the dialogue text box, not "gui/status.png" image from the screen itself. I actually found a solution here, on this forum. Here's the gist of it, cleaned up a little.
akakyouryuu wrote:Edit renpy/display/core.py

Code: Select all

    def show_window(self):

        if not renpy.store._window:
            return

        if not renpy.game.preferences.show_empty_window:
            return

        ############↓Edit
        if getattr(renpy.store, "show_text_during_trans", False):
            return
        ############↑Edit

        if renpy.game.context().scene_lists.shown_window:
            return

        if renpy.config.empty_window:
            renpy.config.empty_window()

~~~~~~~~~~~~~~~~~~~~~~~~~~~~

            while repeat:
                repeat, rv = self.interact_core(preloads=preloads, **kwargs)

            return rv

        finally:

            context.interacting = False

            # Clean out transient stuff at the end of an interaction.
            if clear:
                scene_lists = renpy.game.context().scene_lists
                ####################↓Edited
                if getattr(renpy.store, "show_text_during_trans", False):
                    if ("screens", "say") in scene_lists.additional_transient:
                        scene_lists.additional_transient.remove(("screens", "say"))

                    if ("screens", "nvl") in scene_lists.additional_transient:
                        scene_lists.additional_transient.remove(("screens", "nvl"))
                ####################↑Edited
                scene_lists.replace_transient()

            self.ongoing_transition = { }
            self.transition_time = { }
            self.transition_from = { }
Add below code.

Code: Select all

init python:
    show_text_during_trans = False

init:

    define yj = Character('Yolk')
    image yolk normal = "YolkBase.png"

label start:

    $ show_text_during_trans = True
    yj  "Neither do I.{w=0.5} The Mayor has a{w=0.5} {i}questionable{/i} sense of humor,{w=0.2} so pray she does not come to her senses if you choose to stay."
    show yolk normal
    with dissolve
    extend " And what say you?{w=0.5} Will you accept the terms?{w=0.5}" 
    $ show_text_during_trans = False
It works perfectly for me.

Thanks!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], littleharbour