Multiple different choice menu styles?

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
User avatar
AnnieTiamat
Regular
Posts: 53
Joined: Tue Dec 01, 2015 3:24 pm
Location: Seattle
Contact:

Multiple different choice menu styles?

#1 Post by AnnieTiamat »

Question: can I have more than one choice menu style in the game?

I'm good with the basic centered style for most of the one I'm working on, but for some others (puzzles, mostly) I need to scoot the options elsewhere. Imagine a scenario where you're talking to someone - the basic centered choice menu is ideal here - versus a puzzle taking up most of the center screen.

This would help immensely with not just staging my existing puzzles (so I don't have options covering up the main screen) but allow for potential customization so I'm not scrabbling around with hotspots, and can do more reactive tweaking to text-based elements (like - instead of looped menus for just choosing numbers, setting it up like a keypad).

(Apologies if this is answered elsewhere, but searches just about "choice menu" led me to repeated topics on customizing the style of the base choice menu, which I know how to do.)

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Multiple different choice menu styles?

#2 Post by Remix »

This Oldish Post details one way of tackling the problem by reading the choice strings for a set term.

You could extend that to Ren'py-esque by using "Choice Wording{style=sub_style}" and searching '{style=' to '}' then adding a lot of different flavours.
Frameworks & Scriptlets:

User avatar
AnnieTiamat
Regular
Posts: 53
Joined: Tue Dec 01, 2015 3:24 pm
Location: Seattle
Contact:

Re: Multiple different choice menu styles?

#3 Post by AnnieTiamat »

Bwargh! That new menu thing is SO CLOSE TO WHAT I WANT but it's using the old GUI setup, and I'm on the new one. Seeking a way to parse one into the other...!

Existing code:

Code: Select all

screen choice(items, **kwargs):
    style_prefix "choice"

    vbox:
        for i in items:
            textbutton i.caption action i.action


## When this is true, menu captions will be spoken by the narrator. When false,
## menu captions will be displayed as empty buttons.
define config.narrator_menu = True


style choice_vbox is vbox
style choice_button is button
style choice_button_text is button_text

style choice_vbox:
    xalign 0.5
    ypos 405
    yanchor 0.5

    spacing gui.choice_spacing

style choice_button is default:
    properties gui.button_properties("choice_button")

style choice_button_text is default:
    properties gui.button_text_properties("choice_button")

(Also setting stuff up like a keypad is probably no good, huh. Or at least SUPER complicated...)

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

Re: Multiple different choice menu styles?

#4 Post by philat »

I don't know that that is going to be as flexible as you want, but the basic set up is the following:

Code: Select all

screen choice(items):
    style_prefix "choice"

    vbox:
        for i in items:
            if " (custom)" in i.caption:
                button:
                    action i.action
                    style "menu_choice_custom_button"
                    text i.caption.replace(" (custom)", "") style "menu_choice_custom_text"

            else:
                textbutton i.caption action i.action
Define the custom styles as you see fit.
AnnieDB wrote:(Also setting stuff up like a keypad is probably no good, huh. Or at least SUPER complicated...)
Not really. viewtopic.php?f=8&t=40764#p431022

User avatar
AnnieTiamat
Regular
Posts: 53
Joined: Tue Dec 01, 2015 3:24 pm
Location: Seattle
Contact:

Re: Multiple different choice menu styles?

#5 Post by AnnieTiamat »

Thank you! SO CLOSE. I'm using the new gui formatting, which defines choice buttons via a style prefix. Here's what I've got for them (in gui.rpy)

Code: Select all

## Choice Buttons ##############################################################
##
## Choice buttons are used in the in-game menus.

define gui.choice_button_width = 600
define gui.choice_button_height = None
define gui.choice_button_tile = False
define gui.choice_button_borders = Borders(150, 8, 150, 8)
define gui.choice_button_text_font = gui.default_font
define gui.choice_button_text_size = gui.text_size
define gui.choice_button_text_xalign = 0.5
define gui.choice_button_text_idle_color = "#cccccc"
define gui.choice_button_text_hover_color = "#ffffff"
I'm picking nits here purely because I need those buggers to align. Or at least know more about how they're being called that I can suss that out on my own. I know the phrase is the last 10% takes 90% of the work, but man that is a stressful thing.

Thank you for the help so far (and the link to the keyboard! Trying that out too!)! I'm scratching and I see daylight...

User avatar
AnnieTiamat
Regular
Posts: 53
Joined: Tue Dec 01, 2015 3:24 pm
Location: Seattle
Contact:

Re: Multiple different choice menu styles?

#6 Post by AnnieTiamat »

UPDATE: got the keyboard working and it's great! I'll possibly even be able to resurrect an old discarded puzzle with it - thank you, philat!

Still hacking away at the choice menu, though. Who would have thought something as simple as sliding that sucker over to the right would end up so complicated...!

User avatar
AnnieTiamat
Regular
Posts: 53
Joined: Tue Dec 01, 2015 3:24 pm
Location: Seattle
Contact:

Re: Multiple different choice menu styles?

#7 Post by AnnieTiamat »

UPDATE: still struggling with getting that jerk switched over to the right side of the screen. I know I need to overwrite the xalign from 0.5 to 0.9 in the vbox - but being that the current setup bounces it over from WITHIN the vbox choice script, it's going to still be restrained.

So either I need to find a way to make that overwrite happen, OR:
1. I need to call what is essentially a second choice function that has a NEW menu set up
OR
2. I need to figure out how to make non-choice menus have a timed component (which will mean I need to rewrite everything I have so far to rework it into a new format)

I feel kind of baffled that there isn't another setup for choice menus - that you can't seem to create two in one setting, or at least any that involve moving the text around. I feel it's far more likely that there IS and I'm not aware of it... YET. I hope that changes soon, because option 3 is Attempting to Make It Work, which I'm not fully jazzed about. :P

JimmyFrost
Regular
Posts: 30
Joined: Fri May 01, 2015 9:46 am
Projects: TOWER
Location: United States
Contact:

Re: Multiple different choice menu styles?

#8 Post by JimmyFrost »

Just smashing in via link, and being a rookie of the week, but what is the best practice to injecting the custom button properties? Duplicating the choice properties, and modifying it to be the custom choice properties? Thank you for reading this post.
"If hard work hasn't hurt anyone, then why is there worker's comp?"

Post Reply

Who is online

Users browsing this forum: Google [Bot], simple_human