[SOLVED] Choice menu with additional info pane
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.
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.
[SOLVED] Choice menu with additional info pane
This seems like it should be a question that already has an answer, but my googling has let me down.
What I want is something that behaves like the standard choice menu, except that there is an additional window providing more information on the currently highlighted choice. So when a new option is highlighted, by whatever means, that information panel updates. Think menu-driven RPG combat system.
I can see how to do something a little similar using a 2-step process, where selecting a menu item presents the extra information and a confirm/back pair of options, but that would be very clunky and involve a lot of extra clicking/hitting return.
This doesn't seem like something that easy to patch in to the existing screen as it might involve monkeying about with the programme flow. Is there an example knocking about someone can steer me to, or failing that has anyone got an idea where to start implementing it?
What I want is something that behaves like the standard choice menu, except that there is an additional window providing more information on the currently highlighted choice. So when a new option is highlighted, by whatever means, that information panel updates. Think menu-driven RPG combat system.
I can see how to do something a little similar using a 2-step process, where selecting a menu item presents the extra information and a confirm/back pair of options, but that would be very clunky and involve a lot of extra clicking/hitting return.
This doesn't seem like something that easy to patch in to the existing screen as it might involve monkeying about with the programme flow. Is there an example knocking about someone can steer me to, or failing that has anyone got an idea where to start implementing it?
Last edited by Queex on Thu Apr 13, 2017 11:21 am, edited 1 time in total.
Re: Choice menu with additional info pane
So some further digging in https://www.renpy.org/doc/html/screens.html suggests that I can give the items a hover action to change a screen variable. Then, I think, I can reference that screen variable and display it in a window, as defined in the choice window. However, I think then I need to manually invoke the screen rather than let Renpy do it the usual way.
Re: Choice menu with additional info pane
It would be awesome if we could really do that with the default renpy choice system. AFAIK, Renpy only uses 2 item pairs for the choices (which is caption + action). How would we supply the highlight info?What I want is something that behaves like the standard choice menu, except that there is an additional window providing more information on the currently highlighted choice
My avatar is courtesy of Mellanthe
- Ocelot
- Lemma-Class Veteran
- Posts: 2405
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: Choice menu with additional info pane
Store it in external global variable(s) and pass handle to info for current set of choices encoded in caption string. Or one of the choices themselves.indoneko wrote:AFAIK, Renpy only uses 2 item pairs for the choices (which is caption + action). How would we supply the highlight info?
< < insert Rick Cook quote here > >
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Choice menu with additional info pane
Do you want a pop up screen or a screen that is ever present?
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
Re: Choice menu with additional info pane
Ahh! I never thought of that idea.Ocelot wrote:Store it in external global variable(s) and pass handle to info for current set of choices encoded in caption string. Or one of the choices themselves.
So basically we could use a delimiter in the menu's choice like this?
Code: Select all
menu weekend:
"Hit the book | You will gain some intelligence":
"You spend your weekend at the local library"
$int +=1
"Play basketball | You will gain some power":
"You spend your weekend practicing slam dunk with your friends"
$pow +=1
@trooper6 : how would you code it if it is a pop-up screen/tooltip?
And do you use something similar to Ocelot's method above, or something different?
My avatar is courtesy of Mellanthe
Re: Choice menu with additional info pane
Ideally something that quietly hides itself if there is no context data. Eventually I want to style the choice menus so they're nice and compact in one corner, with the contextual panel in the facing corner if present.trooper6 wrote:Do you want a pop up screen or a screen that is ever present?
I tried to get fancy and arrived at something that I thought would work, but didn't.
I changed the choice screen as follows:
Code: Select all
screen choice(items, **kwargs):
default choice_context=None
style_prefix "choice"
frame:
has vbox
if 'hovered' in kwargs:
for i in items:
textbutton i.caption action i.action hovered SetScreenVariable("choice_context",kwargs['hovered'][i])
else:
for i in items:
textbutton i.caption action i.action
if choice_context is not None:
label choice_context
Code: Select all
python:
hovered={"Item 1":"Hover 1", "Item 2":"Hover 2"}
mout=renpy.display_menu([("Context menu",None),("Item 1",1),("Item 2",2)],hovered=hovered)
Re: Choice menu with additional info pane
I believe I have it licked, functionally.
You use '|' as a delimiter in the menu choice caption. In this implementation, it will also hide the extra info label if the menu item has no extra info given. Of course, the styling will need improvement but the functionality is there.
ETA: You can probably be more efficient and avoid splitting multiple times, but I wasn't sure how much raw python I could get away with in screen language so played it safe.
Code: Select all
screen choice(items):
default choice_context=None
style_prefix "choice"
frame:
has vbox
for i in items:
if '|' in i.caption:
textbutton i.caption.split('|')[0] action i.action hovered SetScreenVariable("choice_context", i.caption.split('|')[1])
else:
textbutton i.caption action i.action hovered SetScreenVariable("choice_context", None)
if choice_context is not None:
label choice_context
ETA: You can probably be more efficient and avoid splitting multiple times, but I wasn't sure how much raw python I could get away with in screen language so played it safe.
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Choice menu with additional info pane
This is similar to what I was thinking. But I was thinking of using renpy.notify
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
Re: Choice menu with additional info pane
Um, why would you use renpy.notify for anything? In my experience it's horrible. And it usually bugs out.trooper6 wrote:This is similar to what I was thinking. But I was thinking of using renpy.notify
Phoenix Star - Persistence, perseverance, ambition.
...
Lost Legends
[VN][Fantasy][Open World] Lost Legends
(Bug Thread) Lost Legends
(Direct Download)
Deviant Art: ...
Lost Legends
[VN][Fantasy][Open World] Lost Legends
(Bug Thread) Lost Legends
(Direct Download)
Discord: saltome
Itch: Phoenix Start
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Choice menu with additional info pane
I've never had a problem with it being buggy. I customize this screen (especially to include animations) and use it in all sorts of different ways. I use it to note hit point losses, or increases in affection...and the what the OP described sounded like a perfect case for renpy.notify.Saltome wrote:Um, why would you use renpy.notify for anything? In my experience it's horrible. And it usually bugs out.trooper6 wrote:This is similar to what I was thinking. But I was thinking of using renpy.notify
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
Who is online
Users browsing this forum: Ahrefs [Bot], Majestic-12 [Bot], snotwurm