Show say screen above another screen

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
User avatar
Kinmoku
Miko-Class Veteran
Posts: 509
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: Love IRL, Memories
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Show say screen above another screen

#1 Post by Kinmoku » Mon May 18, 2020 8:46 am

Hi all, I'm having some trouble showing the say screen/ character monologue over the top of some interface screens I've made. My game's story is mainly told through chat logs (think Discord). However, my character has thoughts outside of this setting and for this I want to use the say screen.

I've currently got the interface screens working, and even the first few character monologues work above them, but shortly after it stops working.

It's been tricky for me to get my head around, so I've likely messed up somewhere. Here's my code in script:

Code: Select all

label start:
    $ gameprogress = "1" ## shows which part of the game the player is at so the correct buttons are showing etc
    
    show screen feudal_fantasy_community(ff1log)
    
    $ ff1log.add_chat(msg="First message.", nick="Nobu", avatar="images/avatars/nobu.png", posttime="< 1 hour ago")
    $ ff1log.add_chat(msg="Second! ^.^", nick="Wolfie", avatar="images/avatars/wolfie.png", posttime="< 1 hour ago")
        
    show screen return_to_story ## this is a Return screen to bring the player back to the dialogue
    pause ## this lets the player read the chat messages without them running off
        
    $ sayscreen_label = "on" ## this animates the thought bubble when it appears for the first time.
    
    t "Maybe I should check how my latest drawing is doing…" ## this works! :D
    
    hide screen return_to_story ## Remove the Return screen
    
    $ notification_on = True
    
    show screen feudal_fantasy_community(ff1log)
    
    pause
    
    ## So, here is where the problem is.
    ## I want to show the previous screen the player was looking at (feudal_fantasy_community(ff1log)) so the player can see there're notifications waiting for them.
    ## Then, they click on the button to go to the notification screen.
    ## Once they have seen the notifications, they Return to the dialogue below...However, the notification screen disappears and the dialogue appears on a black background.

    t "Wow! 96 likes?\nThis is my best one yet!" ## this doesn't work properly
    
    $ sayscreen_label = None ## this stops the thought bubble animating again
    
    t "I wonder if anyone else has posted new artwork in Feudal Fantasy?"
    
    # etc
    
My screens:

Code: Select all

screen say(who, what):
    zorder 1
    style_prefix "say"
    
    if sayscreen_label == "on":
        add "gui/blackout.png" at show_hide_dissolve
        
        window:
            id "window"

            if who is not None:

                window:
                    id "namebox"
                    style "namebox"
                    text who id "who"

            text what id "what"
            at bubbleappear
            
    elif sayscreen_label == "mock":
        window:
            id "window"

            if who is not None:

                window:
                    id "namebox"
                    style "namebox"
                    text who id "who"

            text what id "what"
    
    else:
        add "gui/blackout.png"
        
        window:
            id "window"

            if who is not None:

                window:
                    id "namebox"
                    style "namebox"
                    text who id "who"

            text what id "what"
            
# ...
            
screen return_to_story:
    zorder 50
    modal True 
    
    imagebutton idle Solid("#0000", xysize=(1920, 1080)) action Return() xpos 0 ypos 0 focus_mask None

screen shark_interface:
    zorder 0
    modal True 
    add "interface"
    
    imagebutton idle Solid("#0000", xysize=(250, 200)) clicked [hide_screens(), Show("shark_userpage")] xpos 0 ypos 144 focus_mask None #[hide_screens, Show("shark_userpage")] xpos 0 ypos 144 focus_mask None
    imagebutton idle Solid("#0000", xysize=(250, 200)) clicked [hide_screens(), Show("shark_communities")] xpos 0 ypos 344 focus_mask None#[hide_screens, Show("shark_communities")] xpos 0 ypos 344 focus_mask None
    imagebutton idle Solid("#0000", xysize=(250, 200)) clicked Jump("message_inbox") xpos 0 ypos 544 focus_mask None#[hide_screens, Show("shark_messages")] xpos 0 ypos 544 focus_mask None
    imagebutton idle Solid("#0000", xysize=(250, 200)) clicked [hide_screens(), SetVariable("notification_on", False), Show("shark_notifications")] xpos 0 ypos 744 focus_mask None#[hide_screens, Show("shark_notifications")] xpos 0 ypos 744 focus_mask None
    
    if notification_on == True:
        add "notification" at menu_notifications

screen shark_notifications:
    zorder 0
    modal True 
    tag sharkmenu
    use shark_interface
    
    add "images/menu_on.png" xpos 0 ypos 744
    
    text _("Your Notifications") color "#000000" xpos 30 ypos 16
    
    if gameprogress == "1":
        vbox:
            xpos 334
            ypos 144
            spacing 20
            
            add "emmett_hanzo_hands"
            text "Markus, Nobu, Wolfie and 93 others liked this."
            text "Matcha_thief and Potter-fan liked this."
            
        imagebutton idle Solid("#0000", xysize=(1920, 1080)) action Return() xpos 0 ypos 0 focus_mask None ## the same button from return_to_story
            
screen feudal_fantasy_community(log):
    zorder 0
    modal True 
    tag sharkmenu
    use shark_interface
    
    add "images/menu_on.png" xpos 0 ypos 344
    
    imagebutton idle "images/back_button.png" clicked [Hide("feudal_fantasy_community"), Show("shark_communities")] xpos 16 ypos 960 focus_mask True
    
    imagebutton idle "images/post_button.png" clicked Jump("FF_post") xpos 1700 ypos 16 focus_mask True
    text _("Post") color "#000000" xpos 1780 ypos 30
    
    text _("Feudal Fantasy Community") color "#000000" xpos 30 ypos 16
    
    frame:
        background None
        use chat_log(log)
Since the button on the notification screen is exactly the same as the return_to_story screen, I don't know why it's not working here as well. I tried a few different things out, but the say screen never displays above the notification screen, only on the black background.

It's important for the player to see the thought bubble above the screen so they have context of what's being discussed and aren't pulled out of the moment. Unfortunately, "call screen" doesn't work with my chat log code as that's not part of the screen itself. I'm unsure what I need to do here to get it to work. Does anyone know where I've gone wrong?

Post Reply

Who is online

Users browsing this forum: Google [Bot], plaster