Hiding other interactable screens during dialogue screens?

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
Sleepy
Regular
Posts: 136
Joined: Wed Nov 27, 2013 6:12 pm
Projects: Camera Anima
Organization: EXP-resso Mutt
Tumblr: sleepy-does-games.tumblr.com
itch: https://expressomutt
Contact:

Hiding other interactable screens during dialogue screens?

#1 Post by Sleepy »

I have exploration based gameplay that uses a cursor. How I make it work is during an exploration screen, if the player hovers over an area, it pulls up the other cursors:

Code: Select all

screen houghton_cursor_maskshards_popup():
    mousearea:
        area (10, 460, 150, 90)
        hovered Show("houghton_cursor_maskshards", transition=dissolve)
        unhovered [Hide("houghton_cursor_maskshards", transition=dissolve),Hide("houghton_cursor_hover_maskshards", transition=dissolve)]

screen houghton_cursor_maskshards:
    if iShards not in inventory: 
        imagebutton auto "cursor/base_circle_%s.png" action NullAction() hovered [Show("houghton_cursor_hover_maskshards"), Hide("houghton_cursor_maskshards")] xpos 100 ypos 496 at cursor_hide
      
screen houghton_cursor_hover_maskshards:
    frame at cursor_wheel_dissolve:
        xpadding 0
        ypadding 0
        background None
        xysize (230,130)
        xpos 100 ypos 496
        imagebutton idle "cursor/background_mask.png" hover "cursor/background_mask.png" action NullAction() unhovered [Hide('houghton_cursor_hover_maskshards'), Show("houghton_cursor_maskshards")]
        grid 2 2 xalign 0.5 yalign 0.5:
            imagebutton auto "cursor/topleft_empty_%s.png" action NullAction()
            imagebutton auto "cursor/topright_interact_%s.png" action Jump('click_shards')
            imagebutton auto "cursor/bottomleft_empty_%s.png" action NullAction()
            imagebutton auto "cursor/bottomright_empty_%s.png" action NullAction() 
Though the code works, if a dialogue box pops up, I have to move the mouse to click through the dialogue if the dialogue box overlays part of the mouse area. So I was wondering, is there a way to hide or block interactions with other screens when dialogue screens come up? From what I'm aware, screen variables like imagebuttons disappear when a dialogue box pops up so I was wondering if it was possible to do something similar.
W.I.P.

Image

Complete

Image Image

philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Hiding other interactable screens during dialogue screen

#2 Post by philat »

I'm not sure exactly what you're trying to do, but imagebuttons usually don't disappear by default when dialogue progresses; not sure where you're getting that idea. I suppose you could fiddle with tags, zorder, or modal and experiment for the effect you want, but I'm having a hard time thinking of something very simple -- there would be drawbacks to all of the methods mentioned above which would require workarounds.

User avatar
Sleepy
Regular
Posts: 136
Joined: Wed Nov 27, 2013 6:12 pm
Projects: Camera Anima
Organization: EXP-resso Mutt
Tumblr: sleepy-does-games.tumblr.com
itch: https://expressomutt
Contact:

Re: Hiding other interactable screens during dialogue screen

#3 Post by Sleepy »

I find displayable imagebuttons disappearing when they're onscreen? Such as here http://i66.tinypic.com/v5bom0.png versus here http://i67.tinypic.com/w03w5y.png, where the directional arrow and item added to screen disappear at start of a dialogue. It might be due to the screen set up?

I've fiddled with modal and zorder so far but haven't been able to get it to work right so far. The long get around cheat would be to constantly hide/show the cursor screens so they don't show during the dialogues but that gets really inconvenient. Hence part of why I was wondering if there was an easier way to get it to work.
W.I.P.

Image

Complete

Image Image

philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Hiding other interactable screens during dialogue screen

#4 Post by philat »

Well, whatever you were doing with those buttons, do that with the cursors. ;) It's difficult to say without knowing how those are set up.

In any case, the absolute default behavior -- meaning, if you created a clean test screen with nothing but one button and showed it in the most basic form possible (show screen blahblah() in renpy script) -- is that screens stay up while dialogue progresses.

Another possible workaround would be, I suppose, to use a condition based on get_screen("say"). https://www.renpy.org/doc/html/screen_p ... get_screen I'm just throwing ideas out here, btw, hard to give concrete answers without more information.

User avatar
Sleepy
Regular
Posts: 136
Joined: Wed Nov 27, 2013 6:12 pm
Projects: Camera Anima
Organization: EXP-resso Mutt
Tumblr: sleepy-does-games.tumblr.com
itch: https://expressomutt
Contact:

Re: Hiding other interactable screens during dialogue screen

#5 Post by Sleepy »

After some experimentation, I figured out why things like the area move imagebuttons (and in previous builds, the original interaction imagebuttons) would disappear during dialogues and kinda slapping myself for not catching why earlier. For each explorable area, I have a screen holding its interaction points. However, I was using 'call' instead of 'show' for those screens so the area screen would disappear when a new dialogue/label occurred, then reappear when called again at the end of the label.

Unfortunately, each interaction point need at least two screens to make the cursors work so I can't nest them inside the area screen and hide them that way. However, I did figure out a get around that beats constantly typing out show/hide screens. First, while I still need the cursor screens, I moved the mousearea codes needed to make the cursors pop up under the area code:

Code: Select all

 ####Houghton Front Screens##### 
 
screen houghton_front:  
    on "hide" action Hide("displayTextScreen") 
     
    if iShards not in inventory: 
        add "gisellemaskshards-map.png" xpos 100 ypos 496 xanchor 0.5 yanchor 0.5
     
    #Area Move 
    imagebutton:  
        xpos 1020 
        ypos 446 
        xanchor 0.5 
        yanchor 0.5 
        #area (730, 0, 63, 599) 
        idle "arrowright.png" 
        hover "arrowright.png" 
        action Jump("building_side") 
        #hovered Show("displayTextScreen", displayText = "Side of Building.")  
        unhovered Hide("displayTextScreen")
    
        
     ####Mask Shards Cursor
    mousearea:
        area (10, 460, 150, 90)
        hovered Show("houghton_cursor_maskshards", transition=dissolve)
        unhovered [Hide("houghton_cursor_maskshards", transition=dissolve),Hide("houghton_cursor_hover_maskshards", transition=dissolve)] 
Second, I used "renpy.hide_screen" to create a mass hide action for the cursor screens. I added it to the actions that occur when you start a new interaction with the wheel and it creates a loop for hiding/showing the cursor screens. The mouse areas get called with the area screen, the cursors get called by the mouse areas when hovered, the cursors get hidden as an action while the mouseareas hide with the new interaction, and then the mouseareas (and the cursors by extension) show when the area screen is called again.

Code: Select all

init -1 python:
    #####Houghton Exterior Front#####
    def hide_houghtonexteriorfront_screens():
        renpy.hide_screen("houghton_cursor_maskshards")
        renpy.hide_screen("houghton_cursor_hover_maskshards")
        renpy.hide_screen("houghton_cursor_hover_sign")
        renpy.hide_screen("houghton_cursor_storesign")
        renpy.hide_screen("houghton_cursor_hover_storesign")
        renpy.hide_screen("houghton_cursor_door")
        renpy.hide_screen("houghton_cursor_hover_door")

[...]

screen houghton_cursor_maskshards:
    if iShards not in inventory: 
        imagebutton auto "cursor/base_circle_%s.png" action NullAction() hovered [Show("houghton_cursor_hover_maskshards"), Hide("houghton_cursor_maskshards")] xpos 100 ypos 496 at cursor_hide
      
screen houghton_cursor_hover_maskshards:
    frame at cursor_wheel_dissolve:
        xpadding 0
        ypadding 0
        background None
        xysize (230,130)
        xpos 100 ypos 496
        imagebutton idle "cursor/background_mask.png" hover "cursor/background_mask.png" action NullAction() unhovered [Hide('houghton_cursor_hover_maskshards'), Show("houghton_cursor_maskshards")]
        grid 2 2 xalign 0.5 yalign 0.5:
            imagebutton auto "cursor/topleft_empty_%s.png" action NullAction()
            imagebutton auto "cursor/topright_interact_%s.png" action [hide_houghtonexteriorfront_screens, Jump('click_shards')]
            imagebutton auto "cursor/bottomleft_empty_%s.png" action NullAction()
            imagebutton auto "cursor/bottomright_empty_%s.png" action NullAction() 
It's not quite a perfect fix but it's a more manageable get-around, for the moment.
W.I.P.

Image

Complete

Image Image

Post Reply

Who is online

Users browsing this forum: Bing [Bot]