Putting the menu on the left, or in the center, as needed
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.
- EwanG
- Miko-Class Veteran
- Posts: 711
- Joined: Thu Oct 26, 2006 5:37 pm
- Location: San Antonio, TX
- Contact:
Putting the menu on the left, or in the center, as needed
I know how the style option is used to define the position of the main menu for the game.
In game, there are some menus I would like to have be on the left side of the screen (so I can have the map showing on the right), and others where I want it in the middle of the screen (typical choice behavior).
How do I specify, per menu (if that's even possible) if it's on the left, or in the center?
TIA,
Ewan
In game, there are some menus I would like to have be on the left side of the screen (so I can have the map showing on the right), and others where I want it in the middle of the screen (typical choice behavior).
How do I specify, per menu (if that's even possible) if it's on the left, or in the center?
TIA,
Ewan
- PyTom
- Ren'Py Creator
- Posts: 15893
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
You can't, short of using the ui functions to make your own menus. All of the menus created with menu: share the same style.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom
- PyTom
- Ren'Py Creator
- Posts: 15893
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Actually, there is a way do do this. You'd need to define your own menu function, which checks a variable (or something), and uses that to control where the menu winds up.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom
-
Guest
Menu shown next to character?
Hello, I'm new to using Ren' Py, but I'd also like to be able to put a menu on the left or right hand side of the screen, so that I can display it next to the character speaking. This would let me offer conversation choices (so the player could choose to be 'tactful' or 'decisive' or 'funny' in certain situations.)PyTom wrote:Actually, there is a way do do this. You'd need to define your own menu function, which checks a variable (or something), and uses that to control where the menu winds up.
Having the menu just slapped over the character's face seems so rude!
I did have a look at the demo code for the menu with Eileen standing alongside, but Oh My! Too hard for me to grok at the moment. Is there a simpler way of doing that? (since my choices would either be a straightforward jump or just updating a variable in the player's profile.)
At the moment I've just set button menus to false in the config settings and it's okay, but I do pine for those cool buttons.
Thanks for all your hard work, it's a great system!
- Criptych
- Regular
- Posts: 87
- Joined: Sat Jun 23, 2007 9:19 am
- Projects: ALICE.NET
- Location: The other end of the internet.
- Contact:
You could try something like this:
Then, in your script:
It's not as intuitive, and certainly not the best code (I'm kind of new to Python), but it seems to work. Hope it does for you.
If you're good with Python, some things to add might be:
Code: Select all
init:
python:
# add a choice button to the list
def menu_choice(text,label):
ui.textbutton(text,clicked=ui.jumps(label))
# display a customized menu
def custom_menu(choices, align=0.5):
# choices is a list of tuples
# align is 0.0, 0.5, 1.0 for left, center, right
ui.vbox(xpos=(0.8*align+0.1),xanchor=align,ypos=0.5,yanchor=0.5)
for c in choices:
menu_choice(c[0],c[1])
ui.close()
ui.interact()
Code: Select all
python hide:
custom_menu( [
("I should go with her.", "go_with"),
("She'll be fine alone.", "stay_here"),
("I'll do it myself.", "go")
], 1.0) # right-aligned menu
label go_with:
"I should go with her, it's dangerous."
#...
jump join
label stay_here:
"I'll stay here; she'll be fine alone."
#...
jump join
label go:
"It's a man's job to do the dirty work."
#...
jump join
label join:
# keep going here
It's not as intuitive, and certainly not the best code (I'm kind of new to Python), but it seems to work. Hope it does for you.
If you're good with Python, some things to add might be:
- More position options
- Remember & highlight last choice (for rollback)
- Fix the weird button sizes (they're all different lengths)
- ... who knows?
-
Guest
Positioning menus
Ah, thanks for that.
I'll save the code and and have a fiddle about, see if I can get it to work. The Python machinery is alas all greek to me, so if I get to the point where my wip might see the light of day then I'll come back here begging for prettification.
Much appreciated.
I'll save the code and and have a fiddle about, see if I can get it to work. The Python machinery is alas all greek to me, so if I get to the point where my wip might see the light of day then I'll come back here begging for prettification.
Much appreciated.
- Criptych
- Regular
- Posts: 87
- Joined: Sat Jun 23, 2007 9:19 am
- Projects: ALICE.NET
- Location: The other end of the internet.
- Contact:
I'm sure there's probably an easier way. I've been reading through the Ren'Py source (thank you so much, PyTom, for making it open source!), playing with the menu and menu_window styles-- if it works, that would only add a line or three to your code, instead of half a page! Unfortunately I haven't gotten very workable results yet. Keep your fingers crossed.
Who is online
Users browsing this forum: _ticlock_
