Variable menus with lots of options

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
Pajama Pudding
Newbie
Posts: 4
Joined: Wed Sep 05, 2018 6:46 pm
Contact:

Variable menus with lots of options

#1 Post by Pajama Pudding »

Say I have a menu. The options in that menu are variable, i.e. if Flag A == True, menu option A will appear. At a given point in time, there might be zero associated flags set to True, or there might be as many as 15. If the latter case, there would be far too many menu options to appear on the screen. The most obvious solution, then, would be to have Ren'py execute code to increment a "Counter" variable +1 upward each time a menu option is displayed. If the Counter reaches a certain integer value (e.g. if Counter == 7), it would trigger the game to display an eighth menu option for "More". Clicking on "More" would jump to another label within the scenario, where a second menu would be triggered, displaying the options which were not flagged as having been displayed the first time around. A "spillover" menu, so to speak.

But this only works if there's a way to have Ren'py add flags on or between menu items... Which, I don't know if there is.

If there's a way to do this, or a better way, please let me know.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Variable menus with lots of options

#2 Post by Imperf3kt »

You may be better off making a custom screen with the options on it as buttons.

On a personal note: this idea sounds terrible.
I recently bought a commercial VN with similar design and I've almost run out of save slots just getting halfway through one route! There were so many choices that I don't even remember what prompted most of them.
I hate too many choices.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

4listair
Newbie
Posts: 11
Joined: Tue Jul 31, 2018 10:54 pm
Contact:

Re: Variable menus with lots of options

#3 Post by 4listair »

Coooould you write it as a call screen instead of an ordinary choice menu and then just add a viewport scroll?

Code: Select all

screen choices(xinitial=0.0, yinitial=0.0):
    viewport:
        xinitial yinitial
        scrollbars "vertical"
        mousewheel True
        draggable True
        pagekeys True

        side_yfill True

        vbox:
            if flag_a:
                textbutton _("Flag A.") action Jump("label_a")
            if flag_b:
                textbutton _("Flag B.") action Jump("label_b")
            textbutton _("No flag.") action Jump("no_flag")

Code: Select all

label start:

"1."

$ flag_a = False
$ flag_b = False

"2."

menu:
    "Set flag A.":
        $ flag_a = True
        jump ch
    "Set flag B.":
        $ flag_b = True
        jump ch

label ch:
call screen choices

label label_a:
"A."
jump start

label label_b:
"B."
jump start

label no_flag:
"Nothing."
jump start

return
Something like this, maybe, just with more options?

philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Variable menus with lots of options

#4 Post by philat »

Or just add a viewport to the choice screen.

Post Reply

Who is online

Users browsing this forum: No registered users