Skip to content

Commit 5271b8c

Browse files
committed
add talk_choice menu too
1 parent 6a48103 commit 5271b8c

File tree

3 files changed

+85
-17
lines changed

3 files changed

+85
-17
lines changed

Changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## July 16, 2020 (1.0.1):
2+
- Added settings pane and option to use the `talk_choice` screen instead of the `mas_gen_scrollable` menu
3+
4+
## July 13, 2020 (1.0.0):
5+
- Initial Release

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# All Scrollable Menus
22
### Oops! All Scrollables!
33

4-
This submod replaces the standard Ren'Py menus with the MAS `mas_gen_scrollable_menu`.
4+
This submod replaces the standard Ren'Py menus with the MAS `mas_gen_scrollable_menu` (or the `talk_choice` menu if you wish).
55

66
As such, the following happens when a menu is open:
77
- Monika slides to the left

game/Submods/All Scrollable Menus/all_menus_are_gen_scrollable.rpy

Lines changed: 79 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,31 @@
1+
default persistent._gsm_use_talk_choice = False
2+
13
init -990 python in mas_submod_utils:
24
Submod(
35
author="multimokia",
46
name="All Gen Scrollable Menus",
57
description="A submod which converts all menus to gen-scrollable-menus so Monika's face is never hidden.",
6-
version="1.0.0",
7-
version_updates={}
8+
version="1.0.1",
9+
version_updates=dict(),
10+
settings_pane="gsm_settings"
811
)
912

13+
#START: Settings Pane
14+
screen gsm_settings():
15+
vbox:
16+
box_wrap False
17+
xfill True
18+
xmaximum 1000
19+
20+
hbox:
21+
style_prefix "check"
22+
box_wrap False
23+
24+
textbutton "Use Talk Choice Screen":
25+
action ToggleField(persistent, "_gsm_use_talk_choice")
26+
selected persistent._gsm_use_talk_choice
27+
28+
1029
init 900 python:
1130
def menu_override(items, set_expr):
1231
"""
@@ -47,38 +66,82 @@ init 900 python:
4766
else:
4867
set = None
4968

50-
#Convert items
51-
formatted_menuitems = [
52-
(x[0], x[1], False, False)
53-
for x in items
54-
]
55-
5669
#Prep before showing the menu
5770
renpy.show("monika", at_list=[t21])
5871

5972
#Get last line
6073
last_line = _history_list[-1].what
6174

75+
#Handle the textbox show to keep the question up during the menu
6276
if last_line.endswith("{nw}"):
6377
renpy.say(m, last_line.replace("{nw}", "{fast}"), interact=False)
64-
_history_list.pop()
6578

79+
elif last_line.endswith("{fast}"):
80+
renpy.say(m, last_line, interact=False)
81+
82+
#Otherwise no text, and we should hide the textbox instead
6683
else:
6784
_window_hide()
6885

69-
picked = renpy.call_screen(
70-
"mas_gen_scrollable_menu",
71-
items=formatted_menuitems,
72-
display_area=store.mas_ui.SCROLLABLE_MENU_TXT_AREA,
73-
scroll_align=store.mas_ui.SCROLLABLE_MENU_XALIGN
74-
)
86+
#If the user wishes to use the talk-choice menu, we'll need to parse the input accordingly
87+
if persistent._gsm_use_talk_choice:
88+
menu_items = list()
89+
90+
#Get the location of the menu as MenuEntries need it
91+
location=renpy.game.context().current
92+
93+
#And now make a formatted list of menu_items
94+
for (label, value) in items:
95+
if value is not None:
96+
action = renpy.ui.ChoiceReturn(label, value, location)
97+
chosen = action.get_chosen()
98+
99+
else:
100+
action = None
101+
chosen = False
102+
103+
if renpy.config.choice_screen_chosen:
104+
me = renpy.MenuEntry((label, action, chosen))
105+
else:
106+
me = renpy.MenuEntry((label, action))
107+
108+
me.caption = label
109+
me.action = action
110+
me.chosen = chosen
111+
menu_items.append(me)
112+
113+
#Then call the screen for it
114+
picked = renpy.call_screen(
115+
"talk_choice",
116+
items=menu_items
117+
)
118+
119+
#Otherwise, we use the gen scrollable menu
120+
else:
121+
#Convert items to the 4 part tuple
122+
formatted_menuitems = [
123+
(x[0], x[1], False, False)
124+
for x in items
125+
]
126+
127+
#And show the screen
128+
picked = renpy.call_screen(
129+
"mas_gen_scrollable_menu",
130+
items=formatted_menuitems,
131+
display_area=store.mas_ui.SCROLLABLE_MENU_TXT_AREA,
132+
scroll_align=store.mas_ui.SCROLLABLE_MENU_XALIGN
133+
)
75134

76135
#Reset Monika's position
77136
renpy.show("monika", at_list=[t11])
78137

79-
#And reset the window
138+
#Reset the window
80139
_window_auto = True
81140

141+
#And pop from hist
142+
if last_line.endswith("{fast}"):
143+
_history_list.pop()
144+
82145
#If we have a set, fill it in with the label of the chosen item.
83146
if set is not None and picked is not None:
84147
for label, value in items:

0 commit comments

Comments
 (0)