Page 1 of 1

Customizing Menu Choices

Posted: Thu Oct 11, 2018 5:09 pm
by TomDowd
With apologies, if the answer to this is right under my nose - I've been looking (and will continue to look) - but is it possible to customize the position of menu choice buttons, such as dialogue response choices, so that they can be anywhere on the screen? Right now they vertically stack in the center of the screen and I'd like to change that around. Is it possible?

Thanks in advance!

TD

Re: Customizing Menu Choices

Posted: Thu Oct 11, 2018 6:53 pm
by xavimat
The file screens.rpy has the screen choice, you can customize it as you need. You'll find some style choice... definitions below the screen.
Also gui.rpy has many definitions of styles applied to that screen and its elements, like spacing, positioning, width, etc. Look for the words "gui.choice_". There is an entire section for choice buttons.
You can adapt all of that as you wish.

Re: Customizing Menu Choices

Posted: Fri Oct 12, 2018 11:27 am
by TomDowd
Thank you - that was very helpful!

From looking at it and what properties are accessible it doesn't appear that there's any functionality for using the Menu system for anything other than a stacked set of choices - Is that accurate? I could not, for example, run them horizontally or control the individual location of choices (without ditching the Menu system and using custom buttons directly)?

Thanks again!

TD

Re: Customizing Menu Choices

Posted: Fri Oct 12, 2018 12:01 pm
by rames44
If you wanted to change your whole game to, say, horizontal instead of vertical, you could edit screens.rpy (the “choice” screen) to use an hbox instead of a vbox.

When you use the “menu” command, what Ren’py does is show the “choice” screen and pass in your choices. How they are displayed is then entirely up to the “choice” screen definition, which you can edit to your hearts content. I’ve seen games that have a global variable to select different formats within the choice screen at different points in the game, for example. So, sky’s the limit, depending on how good you are with screen language.

Re: Customizing Menu Choices

Posted: Fri Oct 12, 2018 5:28 pm
by xavimat
You can use a global variable, as rames44 suggest that affect the choice screen and its appearance.

Or you can create different choice screens:
- copy the original one to another named, for example, "choice2" and change the appearance in the copy.
- then use renpy.display_menu to invoke your menus (it's tricky to construct the options, but works). https://www.renpy.org/doc/html/statemen ... splay_menu

Re: Customizing Menu Choices

Posted: Mon Oct 15, 2018 4:32 pm
by TomDowd
Thanks! This all has helped tremendously, but I think I'm going to need a little bit more hand-holding...

Can you place a style block within an if statement? The answer seems to be no, since whenever I do that the code loads the second style block regardless of the value of the variable being tested. I have this:

Code: Select all

if NumChoices == 1:
        style choice_vbox: 
            ypos 100
    else: 
        style choice_vbox: 
            ypos 1000
Note that this is just to test the functionality. If I swap the 100 and 1000 value it's clear that the lower block is being read regardless of the value of NumChoices. NumChoices is set up (as default) elsewhere, not within a label.

What obvious thing am I missing? I'm guessing is that its how the use of style (if that's even appropriate) is handled. How then does one select different formats within the choice screen?

Thanks!

Re: Customizing Menu Choices

Posted: Tue Oct 16, 2018 12:29 pm
by rames44
No, you can use “if” to conditionally define styles, since they’re set up before your game runs.

What you should do is to create two different styles, then inside your screen you can have an “if” statement that either puts something in with one style, or else something (possibly the same thing) with the other style.

Or, you can use a style that omits the item that differs, and use the “if” technique to apply the common style plus the item that varies.

Re: Customizing Menu Choices

Posted: Tue Oct 16, 2018 1:29 pm
by Alex
TomDowd wrote: Thu Oct 11, 2018 5:09 pm .. is it possible to customize the position of menu choice buttons, such as dialogue response choices, so that they can be anywhere on the screen?...
Check this thread - viewtopic.php?f=8&t=52172#p497436