Making a screen insensitive while dialogue

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
MaximeChaos
Newbie
Posts: 9
Joined: Sat Feb 11, 2017 9:21 pm
Contact:

Making a screen insensitive while dialogue

#1 Post by MaximeChaos »

Hi ! :D
I would like to make automatically insensitive a screen that serves to display my inventory and pause buttons every time a choice or a dialogue is in progress.

I think that I have to add something in my "screen say" or "screen choice" in screens.rpy but I can't find what.
Here is this part of my screens.rpy :

Code: Select all

screen say:

    default side_image = None
    default two_window = False
            
    if not two_window:

        window:
            id "window"

            has vbox:
                style "say_vbox"

            if who:
                text who id "who"

            text what id "what"

    else:

        vbox:
            style "say_two_window_vbox"

            if who:
                window:
                    style "say_who_window"

                    text who:
                        id "who"

            window:
                id "window"

                has vbox:
                    style "say_vbox"

                text what id "what"

    if side_image:
        add side_image
    else:
        add SideImage() xalign 0.0 yalign 1.0

screen choice:

    window:
        style "menu_window"
        xalign 0.5
        yalign 0.5

        vbox:
            style "menu"
            spacing 2

            for caption, action, chosen in items:

                if action:

                    button:
                        action action
                        style "menu_choice_button"

                        text caption style "menu_choice"

                else:
                    text caption style "menu_caption"

init -2 python:
    config.narrator_menu = False

    style.menu_window.set_parent(style.default)
    style.menu_choice.set_parent(style.button_text)
    style.menu_choice.clear()
    style.menu_choice_button.set_parent(style.button)
    style.menu_choice_button.xminimum = int(config.screen_width * 0.75)
    style.menu_choice_button.xmaximum = int(config.screen_width * 0.75)
For my first dialogues and choices I did this each time:

Code: Select all

hide screen inventoryandpausemenu
then "show screen" after, each time.

So here what I would want :
-Making said screen insensitive (not hiding), I think there is a command but can't find it.
-Making this automatic because I always need to make insensitive my menu buttons when dialogue box is showing.
-Making my buttons automatically sensitive again after no more dialogue box is showing (if it can't be done automatically I could still put a line in each zone label of my game, that's not the most important).

Thank you very much ! Also sorry if my english is not the best.

User avatar
DannyGMaster
Regular
Posts: 113
Joined: Fri Sep 02, 2016 11:07 am
Contact:

Re: Making a screen insensitive while dialogue

#2 Post by DannyGMaster »

I have this problem too, I'm thinking on a possible workaround:

You could use a function called renpy.get_screen to check if a particular screen is currently active, and if it is, have your code behave the way you want, it depends where you add the checking.

If you were to modify your inventory screen, it would be something like this (written on the fly, not sure if it works):

Code: Select all

screen inventoryandpausemenu:

    if not renpy.get_screen("say") or renpy.get_screen("choice"):

        #Make screen sensitive

    else:
        
        #Make screen insensitive

You could write a similar code in your say and choice screens, checking for the inventory screen and disabling it temporarily.

I'm not sure how to make the screen stop working though, a sort of solution would be make two screens, one that actually works and another that looks insensitive and actually does nothing, you would show the working one while there's not dialogue or choices, and when dialogue appears, you would hide it and show the non-functional screen. I hope that made sense, if you want when I finish my code I will post it and let you know.
The silent voice within one's heart whispers the most profound wisdom.

Post Reply

Who is online

Users browsing this forum: Google [Bot]