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

Winterfire

Forum Fanatic
Respected User
Game Developer
Sep 27, 2018
4,911
7,211
All right, I was about to upload a quick project to show you a way to do that but since it's just a few lines of code, here it is:

(script.rpy)
Code:
define e = Character("Eileen")


init python:
    #1.We make a button, once clicked, we go to another "label".
    def phone_button():
        ui.vbox(xpos=0, ypos=0, xanchor='left', yanchor='top')
        ui.textbutton("Phone", clicked=ui.callsinnewcontext("phone"), xminimum=40, yminimum=20)
        ui.close()

    config.overlay_functions.append(phone_button)

label start:
    scene bg room
    show eileen happy

    e "Click the phone button text on the top left!"
    e "Quickly, before I return to the main menu!"
    e "... ... ..."
    e "... ..."
    e "..."

    return

label phone:
    #2.There can be other dialogue, call the phone interface but most importantly, we hard pause.
    e "I have decided to check my phone..."
    scene bg room
    call screen phone
    $renpy.pause(hard=True)
    e "This will not run."
    e "No matter what, it will not run."
    e "You will never see this, I swear!"

label phone_closed:
    e "I took my phone..."
    e "I did various things, like texting my friends!"
    return

screen phone:
    #3 The phone interface and stuff
    fixed:
         textbutton "Close phone" xalign 0.5 yalign 0.5 action Call("phone_closed")
Note: I did not use any bool and I return to basically nothingness, it is clearly not meant to be used like this but it was a way to show how you can "pause" the dialogue for good while you show the phone screen and then resume (return) to the old dialogue or even go to another dialogue to tell what happened and then resume to the old one, up to you.
 
  • Like
Reactions: wurg

Penfold Mole

Engaged Member
Respected User
May 22, 2017
2,873
6,487
Code:
screen phone:
    tag menu
    ...
Just give it a try. I used it, should be exactly what you want. Adds an option to close the screen by right click or escape key as a bonus.
 
  • Like
Reactions: wurg

wurg

Active Member
Modder
Apr 19, 2018
705
1,629
@Winterfire @SillyxRabbit @mgomez0077 @Penfold Mole

Thank you all for taking the time to help me, with the help of Winterfire we manage to sort out how to make it work. If any of you are interested there are screenshots below.

The solution was to use 'Hide("say")' in the action statement of the imagebutton that displays the character screen. Using this alone would hide the dialog box, but when the user exited out of the character screen the dialog would advance one line from where the user clicked on the imagebutton.

To mitigate this in order to return the user to exactly where they left off in the dialog it was necessary to put 'Rollback(checkpoints = 0)' in the action statement of the return button to close the character screen.

The point of this menu is so the user can access a character screen at any time during game play to see the stats of the characters of the game. Maybe this information will help one of you in the future. Thank you again.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,110
14,787
I have got the perfect thing for you then, especially since you have mentioned being new on ren'py, check:
Can you, please, update your bookmarks ? The thread you link is from 2013, in terms of Ren'py it's like a century ago. 48 versions have been released since this guide was wrote, any many, many things have been added to Ren'py that ease the works of the authors.
 
  • Like
Reactions: Penfold Mole

Winterfire

Forum Fanatic
Respected User
Game Developer
Sep 27, 2018
4,911
7,211
It is not my bookmark: I have checked it myself and everything is pretty much reusable, sure, as the engine evolves things may get deprecated and are kept for the sake of compatibility, this happens to every engine especially if they are old.

If you are a developer you do not just copy/paste but understand the way they are done and why (especially if you are in a new engine/language) and research, upon research you may encounter things that are done differently on new versions and that's fine but it is not like "1" becomes "2" because of that.

It is a bit like you have some recurring code and one day you decide to stop being lazy and turn it into a function, it eases the workflow, makes the code cleaner but it is not like you have to delete everything and start over again =D
Even if it did not run at all, it would still work as pseudocode imho.
 
  • Like
Reactions: SillyxRabbit

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,110
14,787
If you are a developer you [...]
The problem is that the large majority of the people to who you'll give the link are not developers. They are hobbyists that have to do few codding and use Ren'py because it don't need much knowledge. Don't expect them to have your experience and/or to know how to effectively use the information you gave them.
Most of the time they'll stick to what they saw, not even aware that it can have changed a lot among times.


[...] but it is not like "1" becomes "2" because of that.
Effectively, it's more that 1 became 0.5. I mean, there's really people struggling with ui functions, because it's what they found in the outdated cookbook. So they use this, not aware that they can do the same, sometime with a single line where they need two functions, with the second version of the Screen Language.


You want to help, and it's a good thing, welcome on board. But honestly (and I say it without bad intents), giving so outdated links will more often have the opposite effect ; it will let them with a false impression that things are too complicated for their effective knowledge.