From a32b3b9a4ebecf77975acaaea07b42db85a5598a Mon Sep 17 00:00:00 2001 From: GanstaKingofSA Date: Thu, 24 Mar 2022 17:09:16 -0500 Subject: [PATCH] new screen return --- .../{pronoun_example.rpy => pronouns.rpy} | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) rename game/mod_extras/{pronoun_example.rpy => pronouns.rpy} (61%) diff --git a/game/mod_extras/pronoun_example.rpy b/game/mod_extras/pronouns.rpy similarity index 61% rename from game/mod_extras/pronoun_example.rpy rename to game/mod_extras/pronouns.rpy index 6afc1903..83901310 100644 --- a/game/mod_extras/pronoun_example.rpy +++ b/game/mod_extras/pronouns.rpy @@ -3,11 +3,11 @@ ## pronoun_example.rpy # This file asks the user for their pronoun input. -init: - default pronoun_temp = "" +default pronoun_temp = "" init python: def SetPronoun(type): + global pronoun_temp if not pronoun_temp: return if type == "he": persistent.he = pronoun_temp.lower() @@ -26,19 +26,15 @@ init python: him = pronoun_temp.lower() him_capital = pronoun_temp.lower().capitalize() pronoun_temp = "" - renpy.hide_screen("pronoun_input") -label pronoun: - while not persistent.he: - $ renpy.show_screen("pronoun_input", message="Enter your first pronoun (He/She/They)", ok_action=Function(SetPronoun, "he")) - while not persistent.him: - $ renpy.show_screen("pronoun_input", message="Enter your second pronoun (Him/Her/Them)", ok_action=Function(SetPronoun, "him")) - while not persistent.hes: - $ renpy.show_screen("pronoun_input", message="Enter your third pronoun (He's/She's/They're)", ok_action=Function(SetPronoun, "he's")) - while not persistent.are: - $ renpy.show_screen("pronoun_input", message="Enter your fourth pronoun (Is/Are)", ok_action=Function(SetPronoun, "are")) +label pronoun_screen: + $ renpy.call_screen("pronoun_input", message="Enter your first pronoun (He/She/They)", ok_action=Function(SetPronoun, type="he")) + $ renpy.call_screen("pronoun_input", message="Enter your second pronoun (He's/She's/They're)", ok_action=Function(SetPronoun, type="he's"), hes=True) + $ renpy.call_screen("pronoun_input", message="Enter your third pronoun (Him/Her/Them)", ok_action=Function(SetPronoun, type="him")) + $ renpy.call_screen("pronoun_input", message="Enter your fourth pronoun (Is/Are)", ok_action=Function(SetPronoun, type="are")) + return -screen pronoun_input(message, ok_action): +screen pronoun_input(message, ok_action, hes=False): ## Ensure other screens do not get input while this screen is displayed. modal True @@ -60,11 +56,16 @@ screen pronoun_input(message, ok_action): label _(message): style "confirm_prompt" xalign 0.5 + + python: + allowList = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + if hes: + allowList = allowList + "'" - input default "" value VariableInputValue("pronoun_temp") length 12 allow "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + input default "" value VariableInputValue("pronoun_temp") length 12 allow allowList hbox: xalign 0.5 spacing 100 - textbutton _("OK") action ok_action \ No newline at end of file + textbutton _("OK") action [ok_action, Return(0)] \ No newline at end of file