Ren'Py [Solved] Need help hiding the dialogue box when a character screen is in the foreground

wurg

Active Member
Modder
Apr 19, 2018
705
1,623
To get some practice with RenPy and Python I created a small game to place a image on the screen so the user can click it to get to a character screen. Everything works fine with the menu, my issue is I would like to hide the dialogue box of the game to give it a cleaner look. I can't figure out how to hide it and bring it back without the game causing an error.

I can't use window show/hide because the menu pops up on an action statement.

I've tried using Hide("say"), which works to hide the dialogue box when the character screen is displayed. Left with only this command when the user exits out of the menu they can click to get the dialogue box back but the dialog has advanced one line. I would like it to stay at the same line as when the user left.

If I use Show("say") in conjunction with the Hide statement the game errors out. "Exception: Required parameter who has no value." I'm assuming it's dumping the dialogue when it hides the dialogue box causing this error when I try to show it again.

Most of the code I lifted from another game and modified so that I could use it, and also the pictures, this is me just practicing and learning and I can't figure out how to make this work. I've went through the forum, searched online, the tutorial that comes with the RenPy engine, and the docs that come with it and can't find a solution.

Code to call the character screen:
Code:
screen topRightMenu tag topRightMenu:       # Chracter Menu
    modal False                        # Makes the background game interactable

    imagebutton:
        idle "phone_idle" hover "phone_hover" xalign 0.98 yalign 0.01 action [Show("char_screen"),renpy.restart_interaction]
        # imagebutton in upper right corner - when clicked upon opens char_screen for stats
Code to return to the game:
Code:
    frame:                              # Hides the character screen and will save the name input for the main character
        style_group "menu_choice"
        xalign 0.5
        yalign 0.97
        has hbox
        textbutton "Return" action Hide("char_screen"),
Any help will be appreciated.
 

Winterfire

Forum Fanatic
Respected User
Game Developer
Sep 27, 2018
4,848
7,130
Have you tried ?
 
  • Like
Reactions: wurg

wurg

Active Member
Modder
Apr 19, 2018
705
1,623
@Winterfire
I'm pretty new to Renpy and Python but when I put it in the code it just throws errors, I'm familiar with how renpy.pause works when the dialog is displayed or when you use it to as a substitute for an animation with a group of pictures, but it doesn't like it this way. I'm placing a screen on top of the master screen and want to hide the dialog box on the master screen basically for aesthetics.
 

Winterfire

Forum Fanatic
Respected User
Game Developer
Sep 27, 2018
4,848
7,130
So basically you are making a scene like a gallery or main menu which does not require a dialogue box to begin with?
 
  • Like
Reactions: wurg

wurg

Active Member
Modder
Apr 19, 2018
705
1,623
So basically you are making a scene like a gallery or main menu which does not require a dialogue box to begin with?
Correct, when the icon is clicked it brings up a character selection screen, and when you click on the character it'll bring up stats for that specific character.

Capture1.PNG 3.PNG 4.PNG
 

Winterfire

Forum Fanatic
Respected User
Game Developer
Sep 27, 2018
4,848
7,130
I have got the perfect thing for you then, especially since you have mentioned being new on ren'py, check:


It has everything you are looking for and more, check its code, this is the best way to learn imho.
Good luck!
 
  • Like
Reactions: wurg

wurg

Active Member
Modder
Apr 19, 2018
705
1,623
window show/hide could be what you're looking for.
Unfortunately I tried that, I can't use window show/hide because the user could pull the screen up at any time in the dialog and the engine tells me that is not a keyword argument or valid child statement for the screen statement. I just tried putting 'config.window_hide_transition' as part of the action statement that calls up the character screen to no avail, the game doesn't error out, it just has no effect.
 

Winterfire

Forum Fanatic
Respected User
Game Developer
Sep 27, 2018
4,848
7,130
The link I gave you did not help? It has what you are looking for.
I will a detailed answer later if that did not help you, unless someone else does it first.
 
  • Like
Reactions: wurg

wurg

Active Member
Modder
Apr 19, 2018
705
1,623
The link I gave you did not help? It has what you are looking for.
I will a detailed answer later if that did not help you, unless someone else does it first.
I'm still looking through it, there's a lot there, but I am trying.
 

Winterfire

Forum Fanatic
Respected User
Game Developer
Sep 27, 2018
4,848
7,130
Yeah, thought you might find it useful overall.
If you still struggle to find the answer, let us know and once I can I will write a more in-depth reply.
 
  • Like
Reactions: wurg

Winterfire

Forum Fanatic
Respected User
Game Developer
Sep 27, 2018
4,848
7,130
@wurg

All right, tested on: 16.12.08-quick-start Renpy Framework

What you should be looking at is "script.rpy", the line 143 looks like this:
Python:
label home:
    scene bg default
    show screen home
    show screen calendar
    $renpy.pause()

    while True: # This makes sure that we can toy with it without leaving the game.
        $ result = ui.interact()
This will show the scene (home, calendar, phone... Whatever you want) with no dialogue text, because there is none to begin with.
If you want dialogue AFTER that, make it happen once someone starts the day, or once you are out of that "Home" scene, dialogue before all that is fine, try adding this:

Code:
label home:
    "Hello, this is a test"
    scene bg default
    show screen home
    show screen calendar

    while True: # This makes sure that we can toy with it without leaving the game.
        $ result = ui.interact()
The text will show (on a blank BG because we did not add any before the text) and after that, everything will load up without any text afterwards, that is because there is no text in the other lines... the dialogue will be called once we click somewhere else (ex. "Start day").

However, if you want/need the dialogue afterwards but unlockable only after certain conditions are met, try this:
Code:
label home:
    "Hello, this is a test"
    scene bg default
    show screen home
    show screen calendar
    $renpy.pause(hard=True)
    "Will this run"

    while True: # This makes sure that we can toy with it without leaving the game.
        $ result = ui.interact()
The "Will this run" will never run, because we forced a hard pause... No text will be shown even if there is some.
If you put a conditional, it will run only when you need it to ( ).

Good luck and let us know if this is solved!


-edit-
To explain myself better to fit better your situation, some pseudocode could be:
If (clickedphone) then pause $renpy.pause(hard=True)
else just show the message.

You should aim to make it more similar to that framework tho, less confusing.
So just have text in separate scenes where it is supposed to happen and not all in one thing cos once your project gets bigger, it will be messy.
 
  • Like
Reactions: wurg

wurg

Active Member
Modder
Apr 19, 2018
705
1,623
@wurg

All right, tested on: 16.12.08-quick-start Renpy Framework

What you should be looking at is "script.rpy", the line 143 looks like this:
Python:
label home:
    scene bg default
    show screen home
    show screen calendar
    $renpy.pause()

    while True: # This makes sure that we can toy with it without leaving the game.
        $ result = ui.interact()
This will show the scene (home, calendar, phone... Whatever you want) with no dialogue text, because there is none to begin with.
If you want dialogue AFTER that, make it happen once someone starts the day, or once you are out of that "Home" scene, dialogue before all that is fine, try adding this:

Code:
label home:
    "Hello, this is a test"
    scene bg default
    show screen home
    show screen calendar

    while True: # This makes sure that we can toy with it without leaving the game.
        $ result = ui.interact()
The text will show (on a blank BG because we did not add any before the text) and after that, everything will load up without any text afterwards, that is because there is no text in the other lines... the dialogue will be called once we click somewhere else (ex. "Start day").

However, if you want/need the dialogue afterwards but unlockable only after certain conditions are met, try this:
Code:
label home:
    "Hello, this is a test"
    scene bg default
    show screen home
    show screen calendar
    $renpy.pause(hard=True)
    "Will this run"

    while True: # This makes sure that we can toy with it without leaving the game.
        $ result = ui.interact()
The "Will this run" will never run, because we forced a hard pause... No text will be shown even if there is some.
If you put a conditional, it will run only when you need it to ( ).

Good luck and let us know if this is solved!
I think there is a misunderstanding, what I have is a character screen that pops up whenever the user clicks on the phone icon in the upper right hand corner. This is accessible by the user at any point in the dialog in the game. My thoughts are to let the user see the stats of the character as they change during the game play. Everything works as it should, I just can't get the dialog box to disappear in the background and come back in the same position when the user closes the character screen. Putting the 'Hide("say")' statement in the 'action' statement of the imagebutton will hide the dialog box, but when the user exits it advances the dialog one line, the user also has to click to bring the dialog box back up. If I put 'Show("say")' in the action statement for the 'Return' button to exit the character screen, the game throws an error.

I really appreciate the help, I'm trying to use this more in a linear fashion and I think you are thinking more of a sandbox style.
 

Winterfire

Forum Fanatic
Respected User
Game Developer
Sep 27, 2018
4,848
7,130
That sounds like something that can be done with a $renpy.pause(hard=True).
On the "Phone label" just put that pause and once it is closed, resume.
Or use a conditional (bool) to see whatever it is open or not.
 
  • Like
Reactions: wurg

wurg

Active Member
Modder
Apr 19, 2018
705
1,623
Have you tried using python equivalent?:

Code:
_window_hide(trans=False)
I tried putting that in the 'action' statement and it didn't hide the dialog box, but weirdly broke the game after you exited out of the character screen and advanced the dialog. And, it tells me it's not a child statement of a screen.
 

SillyxRabbit

Newbie
Oct 13, 2016
50
68
One idea is to create a overlay between screen and overlay like this:
define config.layers = ['master', 'transient', 'screens', 'over_screens', 'overlay']

Then onlayer over_screens for char_screen. Let me know if this helps.

Edit: just a note, it doesn't hide your dialogue window. But dialogue window won't get in the way either.
 
  • Like
Reactions: wurg

wurg

Active Member
Modder
Apr 19, 2018
705
1,623
One idea is to create a overlay between screen and overlay like this:
define config.layers = ['master', 'transient', 'screens', 'over_screens', 'overlay']

Then onlayer over_screens for char_screen. Let me know if this helps.

Edit: just a note, it doesn't hide your dialogue window. But dialogue window won't get in the way either.
I tried it this way and without quotes to no avail, it just pisses me off I can hide it but can't get it back in the same spot.

Edit: also tried the same thing using 'onlayer=' with no change.

Code:
# in options.rpy
define config.layers = ['master', 'transient', 'screens', 'overlay', 'charScreen', 'indCharScreen' ]

# In screens.rpy
screen topRightMenu tag topRightMenu:       # Chracter Menu
    modal False                        # Makes the background game interactable

    imagebutton:
        idle "phone_idle" hover "phone_hover" xalign 0.98 yalign 0.01 action [Show("char_screen", layer="charScreen"), renpy.restart_interaction]
        # imagebutton in upper right corner - when clicked upon opens char_screen for stats
 

Penfold Mole

Engaged Member
Respected User
May 22, 2017
2,855
6,379
What if you just tag your screen as a menu:

Code:
screen whatever():
    tag menu
That way it works as one of the menu screens. Should be the easiest solution, IMHO.
 
  • Like
Reactions: wurg