Suggestion: "interactive" keyword for screenlang

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
strayerror
Regular
Posts: 125
Joined: Fri Jan 04, 2019 3:44 pm
Contact:

Suggestion: "interactive" keyword for screenlang

#1 Post by strayerror » Sat Mar 02, 2019 12:50 am

Some screens can be very decorative as well as functional, and sometimes it makes sense for a screen to remain visible while dialogue occurs, or a video plays etc. For these situations it would be very useful for a screen to be able to become immune to player interaction, while remaining visually unchanged.

The suggestion is for a new interactive/sensitive keyword to be added to SL. It would accept a python statement that would evaluate at render-time and affect the focus keyword argument to blit (and probably other things for performance).

ScreenDisplayable already has the groundwork in place for this as screens are capable of rendering non-interactively during their HIDE phase for use with transitions. The new keyword would just serve to provide more flexible access to this existing functionality.

The use case that triggered this request (viewtopic.php?t=54084) was being able to show dialogue atop an temporarily inactive screen. This could be facilitated thus:

Code: Select all

screen foodmenu():
    # become non-interactive whenever the say screen is active
    interactive not renpy.get_screen('say')

    vbox:
        textbutton 'Chicken' action NullAction()
        textbutton 'Fish' action Call('fish')
        textbutton 'Bobcat' action NullAction()
        
label fish:
    'Ewww {color=077}fish{/color}? I think not!'
    'Check it out, the {b}foodmenu{/b} buttons are non-interactive right now!'
    return
Key features:
  • Distinct from SensitiveIf - A screen may have a mix of sensitive and insensitive controls already, they shouldn't visually change based on the new keyword.
  • Events such as select and hover should not occur or trigger visual changes
  • The non-interactive screen should not obstruct interactivity with other screens/layers
Finally, here's a PoC for 7.2-pre abusing the internal ScreenDisplayable.phase to demonstrate the desired behaviour:

Code: Select all

screen foodmenu():
    vbox:
        textbutton 'Chicken' action NullAction()
        textbutton 'Fish' action Call('fish')
        textbutton 'Bobcat' action NullAction()
        
label fish:
    $ renpy.get_screen('foodmenu').phase = renpy.display.screen.HIDE
    'Ewww {color=077}fish{/color}? I think not!'
    'Check it out, the {b}foodmenu{/b} buttons are non-interactive right now!'
    $ renpy.get_screen('foodmenu').phase = renpy.display.screen.UPDATE
    return
Thanks for considering, and for all the hard work put into making Ren'Py great! :)

Post Reply

Who is online

Users browsing this forum: No registered users