Add the call_screen_in_new_context utility function/label

This commit is contained in:
Gouvernathor 2023-11-21 21:02:49 +01:00
parent 82018cfdad
commit a9bf2a637e
2 changed files with 12 additions and 0 deletions

View File

@ -219,3 +219,10 @@ init python early:
if match: if match:
return int(match.group(1)) return int(match.group(1))
return float('inf') # Return a large number for non-numeric keys return float('inf') # Return a large number for non-numeric keys
def call_screen_in_new_context(sc_name, *args, **kwargs):
"""
Calls the `sc_name` screen in a new context, passing it *args and **kwargs.
Returns the value returned by the screen, if any.
"""
return renpy.call_in_new_context("call_screen", sc_name, *args, **kwargs)

View File

@ -152,3 +152,8 @@ label end_of_content():
nar "All stats have been maxed out. You can now use all of the wardrobe options." nar "All stats have been maxed out. You can now use all of the wardrobe options."
return return
label call_screen(sc_name, *args, **kwargs):
# call call_screen("name", *args, **kwargs) <=> call screen name(*args, **kwargs)
call screen expression sc_name pass (*args, **kwargs)
return _return