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!
[Solved] Screen transition not affecting a textbox
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.
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.
[Solved] Screen transition not affecting a textbox
Last edited by Lorgan on Sun Dec 02, 2018 8:59 pm, edited 1 time in total.
Re: Screen transition not affecting a textbox
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.
Re: Screen transition not affecting a textbox
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."
Re: Screen transition not affecting a textbox
The easiest way is to separate your StatusScreen() and your text since it appears that your text is subject to change anyway.
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.
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
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."
###
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."
Re: Screen transition not affecting a textbox
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.
Thanks!
It works perfectly for me.akakyouryuu wrote:Edit renpy/display/core.pyAdd below code.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 = { }
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
Thanks!
Who is online
Users browsing this forum: Ahrefs [Bot], littleharbour