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

wurg

Active Member
Apr 19, 2018
240
303
#1
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.
 

Attachments

wurg

Active Member
Apr 19, 2018
240
303
#3
@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

Active Member
Game Developer
Sep 27, 2018
179
184
#4
So basically you are making a scene like a gallery or main menu which does not require a dialogue box to begin with?
 
Likes: wurg

wurg

Active Member
Apr 19, 2018
240
303
#5
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.

236744_Capture1.png 236745_3.png 236746_4.png
 

Winterfire

Active Member
Game Developer
Sep 27, 2018
179
184
#6
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!
 
Likes: wurg

wurg

Active Member
Apr 19, 2018
240
303
#9
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

Active Member
Game Developer
Sep 27, 2018
179
184
#10
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.
 
Likes: wurg

Winterfire

Active Member
Game Developer
Sep 27, 2018
179
184
#12
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.
 
Likes: wurg

Winterfire

Active Member
Game Developer
Sep 27, 2018
179
184
#14
@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.
 
Likes: wurg

wurg

Active Member
Apr 19, 2018
240
303
#15
@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

Active Member
Game Developer
Sep 27, 2018
179
184
#16
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.
 
Likes: wurg

wurg

Active Member
Apr 19, 2018
240
303
#17
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.
 
Oct 13, 2016
36
33
#18
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.
 
Likes: wurg

wurg

Active Member
Apr 19, 2018
240
303
#19
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

Well-Known Member
May 22, 2017
1,152
1,558
#20
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.
 
Likes: wurg

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.