Can a screen be made non-interactive while "saying"?

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
strayerror
Regular
Posts: 154
Joined: Fri Jan 04, 2019 3:44 pm
Contact:

Can a screen be made non-interactive while "saying"?

#1 Post by strayerror » Fri Mar 01, 2019 3:15 pm

The scenario is a player character reading a food menu. The player can click on items in the menu and some will lead to an order being made and the story progressing (a jump statement), some will trigger a small exposition dialogue about not liking an item, while continuing to "look" at the menu.

Using show screen with the menu and call screen on an empty screen (pass) solves the issue with call screen being transient which was causing the menu to disappear during the exposition. However the problem now is items on the menu remain interactive while the exposition plays, ideally I'd like to disable interactivity of the screen during this to prevent clicking another item until the current exposition is concluded.

I wasn't able to find anything obvious when it came to disabling a whole screen, so my next thought was to see if a second (transparent) screen could be shown on top to intercept interactions. Both an empty modal screen and a non-modal screen containing a full screen (transparent) imagebutton with a NullAction resulted in the menu screen being disabled successfully ... unfortunately they also blocked being able to progress through the dialogue. >_<

I can't help but feel I must be missing a trick here, but I can't find any obvious freeze/disable screen flag I could toggle. :/

P.S. I know individual elements can have a boolean sensitive flag set, however in addition to having to be set on everything individually, it also triggers an undesirable appearance change. Some menu items will already be insensitive because the player can't afford them, having everything switch between appearing affordable and not while the dialogue plays wouldn't be ideal at all. :(

P.P.S. I also tried adding modal True to the say screen in screens.rpy thinking it'd make dialogue the only thing able to be interacted with, unfortunately this too disabled all forms of progression. :(

Here's the sample I've been playing with:

Code: Select all

label start:
    scene expression Solid('ccc')
    show screen foodmenu()
    while True:
        call screen blank
    return


label end:
    'You won the game!'
    return


label chicken:
    hide screen foodmenu
    'The {color=770}chicken{/color} sounds good'
    'OM NOM NOM'
    jump end


label fish:
#     show screen nope_modal() # blocked dialogue progression
#     show screen nope_null() # blocked dialogue progression
    'Ewww {color=077}fish{/color}? I think not!'
#     hide screen nope_null
#     hide screen nope_modal
    return


screen blank():
    pass


screen foodmenu():
    vbox:
        textbutton 'Chicken' action Jump('chicken')
        textbutton 'Fish' action Call('fish')


screen nope_modal():
    modal True


screen nope_null():
    imagebutton idle Fixed() action NullAction()
Thanks!

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Can a screen be made non-interactive while "saying"?

#2 Post by Remix » Fri Mar 01, 2019 6:28 pm

Maybe:

Code: Select all

        textbutton 'Chicken' action If( renpy.get_screen("say"), NullAction(), Jump('chicken') )
        ## If( condition, True action(s), False action(s) )
Nulled while say screen is up (though still sensitive), active and jumpy when say screen gone
Frameworks & Scriptlets:

strayerror
Regular
Posts: 154
Joined: Fri Jan 04, 2019 3:44 pm
Contact:

Re: Can a screen be made non-interactive while "saying"?

#3 Post by strayerror » Fri Mar 01, 2019 6:57 pm

Thanks Remix, the say detection is definitely on the right lines, but unfortunately using a NullAction() doesn't suppress the hovered styling making it appear to the player as if it's interactable, and if the player clicks to advance while the mouse is over one of the nulled buttons, the event is eaten rather than triggering dialogue progression.

I've been investigating a bit more and I think at a code level what I'm trying to do is to tell the screen to ignore all events, but still have them propagate such that they can advance the dialogue. Essentially having the screen act temporarily more like a Composite displayable than a screen, not really sure how feasible that is yet though. :/

strayerror
Regular
Posts: 154
Joined: Fri Jan 04, 2019 3:44 pm
Contact:

Re: Can a screen be made non-interactive while "saying"?

#4 Post by strayerror » Fri Mar 01, 2019 11:27 pm

So it seems like this is kinda already present after a fashion in order to support transitions, but unfortunately there's no nice way to leverage it. The desired effect can be demonstrated with:

Code: Select all

label fish:
    $ renpy.get_screen('foodmenu').phase = renpy.display.screen.HIDE
    'Ewww {color=077}fish{/color}? I think not!'
    'Check it out, the foodmenu buttons are disabled right now!'
    $ renpy.get_screen('foodmenu').phase = renpy.display.screen.UPDATE
    return
Please note however that this is not rollback safe and relies on unsafe internal usage. Do not use in production code. I'll do a better write up as a feature request in a suggestion thread in the dev forum. :)

Post Reply

Who is online

Users browsing this forum: Google [Bot]