Creating a new main menu.
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.
Creating a new main menu.
I want to create a new main menu with four buttons (New Game, Load Game, Options, Quit), but not in a vertical arrangement like the default menu. Each button would have a mouseover effect. I suppose if you connected the buttons with lines, they'd make a parallelogram angled left. I've been looking through the documentation and the options, and I did a couple of searches on the forum, but I'm not having much luck in finding something clear about how to go about doing this.
One of the things I'm not seeing much of at all is how to position the buttons, actually...
I'm not even sure where to start on this, heh. I was also considering an imagemap, but the documentation doesn't seem to be very clear on that, either... for example, are the coordinates from the ground image of the imagemap, or are they from the upper-left corner of the window? In any case, all four buttons would have different mouseover effects, and you can have only one selected image...
Any suggestions? Sorry about the trouble.
One of the things I'm not seeing much of at all is how to position the buttons, actually...
I'm not even sure where to start on this, heh. I was also considering an imagemap, but the documentation doesn't seem to be very clear on that, either... for example, are the coordinates from the ground image of the imagemap, or are they from the upper-left corner of the window? In any case, all four buttons would have different mouseover effects, and you can have only one selected image...
Any suggestions? Sorry about the trouble.
Re: Creating a new main menu.
As a side note, I /have/ read the "From Scratch" section of http://renpy.org/wiki/renpy/doc/referen ... Game_Menus and I'm pretty much as lost as I was before.
Re: Creating a new main menu.
Screwing around with some stuff, still...
Seems to give me what I want, but the game just skips it even though it's under the mainmenu label. If I put up a text field, the game stops there and I can see the button, the mouseover works... but if I click, I get a "AttributeError: 'RevertableObject' object has no attribute 'main_menu'" error.
Am I completely on the wrong track here?
Code: Select all
$ ui.at(Position(xpos=100, ypos=380))
$ ui.imagebutton(idle_image='load.png', hover_image='load_over.png', clicked=ui.jumps("_load_screen"))
Am I completely on the wrong track here?
Re: Creating a new main menu.
I'm pretty sure that you shouldn't need to work from scratch, you should be able to do all you want just by styling the existing buttons. I think you should probably start by looking at config.main_menu_positions, and also look through the default 'roundrect' theme (IIRC it's in the 'common' directory, but I don't have a Ren'Py installation in front of me to check). Unfortunately that's about all I can suggest right now, 'cause it's been a while since I touched that stuff last, but I'm fairly confident that's the right starting point.Scott wrote:As a side note, I /have/ read the "From Scratch" section of http://renpy.org/wiki/renpy/doc/referen ... Game_Menus and I'm pretty much as lost as I was before.
(Of course, the usual advice-to-new-people remains valid, really - positioning the buttons for your menu isn't nearly important as having a fun, playable game for the menu to point to, so you should work on that first. And if you have a fun, playable game to show them you'll more than likely find someone willing to code your menu (and tricky bits of the game, and so on) for you anyway.)
Server error: user 'Jake' not found
Re: Creating a new main menu.
Yeah, I realize that the menu isn't all that important in the grand scheme of things, but it's a good part of the mood I'm trying to set.
Re: Creating a new main menu.
As a side note, one of the other problems is that I'm using a TTF font that looks fine at larger sizes, but when used at the size of the menu, it turns into blocks (presumably because it's bitmapped at that particular size) -- so it'd be nice to just skip that altogether with image buttons, since I can customize those a little more.
The code for the menu is about the same as what's posted on the site... and just as illuminating. I'm not seeing any actual button placement here, though it looks like config.main_menu_positions can do SOMETHING... I'm just not sure what, since I can't find any documentation on it.
It really feels like most of this stuff should just be in functions that I can't find and that I should be able to do something simpler, like what's in my code snippet... make a button, position it, and give it a certain function. >.>
The code for the menu is about the same as what's posted on the site... and just as illuminating. I'm not seeing any actual button placement here, though it looks like config.main_menu_positions can do SOMETHING... I'm just not sure what, since I can't find any documentation on it.
It really feels like most of this stuff should just be in functions that I can't find and that I should be able to do something simpler, like what's in my code snippet... make a button, position it, and give it a certain function. >.>
Re: Creating a new main menu.
Yet another post in my own thread... I gave up and registered since I've been posting so much.
I'd be happy (I think) if I could just get rid of the backgrounds of the buttons and the menu itself, then use the example in the cookbook to reposition those buttons... and then change the font on the menu itself. The only problem is that this would keep me from using mouseover images, but I'd be mostly satisfied even without those, I guess.
So... is there a way to just get rid of the backgrounds of the buttons and the menu?
I'd be happy (I think) if I could just get rid of the backgrounds of the buttons and the menu itself, then use the example in the cookbook to reposition those buttons... and then change the font on the menu itself. The only problem is that this would keep me from using mouseover images, but I'd be mostly satisfied even without those, I guess.
So... is there a way to just get rid of the backgrounds of the buttons and the menu?
Re: Creating a new main menu.
PyTom, perhaps it might be the right time to make a custom image button menu-making tool.
The farthest I've gone in menu-making is basically stripping the entire roundrect theme and designing everything as part of the flattened background (thus only the text is hoverable)
To do this, just remove the block in options.rpy invoking the roundrect theme. The default font will then become your menu font. There is a better way to reposition the menu text (library translations? config something?), but the way I did it was just to go into the renpy directory and change the positions in the relevant .rpy file for the menus.
The farthest I've gone in menu-making is basically stripping the entire roundrect theme and designing everything as part of the flattened background (thus only the text is hoverable)
To do this, just remove the block in options.rpy invoking the roundrect theme. The default font will then become your menu font. There is a better way to reposition the menu text (library translations? config something?), but the way I did it was just to go into the renpy directory and change the positions in the relevant .rpy file for the menus.
Re: Creating a new main menu.
I think that's what config.main_menu_positions is for.DaFool wrote:There is a better way to reposition the menu text (library translations? config something?)
My Python is rusty, so I can't try and provide example code, but I was under the impression that a 'map' was a functional-programming-style method which applies a function to a list of inputs - and I'm not entirely sure why that would be used here - and a 'dictionary' was a series of key/value pairs of the form:
Code: Select all
myDictionary = { key1:value1, key2:value2, ... , keyn:valuen }
I expect the keys for the map will be the same 'restart', 'load', 'save', 'prefs' and 'quit' seen in the customising-the-main-menu article linked above. If I were trying to do this, I'd start by looking up 'map' in the Python documentation in case I've missed something obvious, then look at mapping the text menu-item labels onto dictionaries full of the same properties used for laying out UI elements.
I'm pretty sure the reason it's not recommended that you go changing things in the 'renpy' directory is simply that it prevents you (and anyone trying to run your game) from performing drag-and-drop upgrades of the Ren'Py engine.DaFool wrote:but the way I did it was just to go into the renpy directory and change the positions in the relevant .rpy file for the menus.
If you release a game, then there's a bug discovered in Ren'Py where the engine accidentally deletes the user's home directory on Linux platforms when certain really-obscure data conditions are met which happen to have cropped up in your script, then Linux users will want to run your game with the later, fixed version of the engine; normally they'd be able to do this by copying the 'game' directory into a fresh install of the engine and running it from there, but if you fiddle with stuff in any other directories that might break your game. You'll have the same problem if you find you want to upgrade the engine partway through development to take advantage of new features.
[EDIT: fixing markup]
Server error: user 'Jake' not found
- PyTom
- Ren'Py Creator
- Posts: 16088
- 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:
Re: Creating a new main menu.
DaFool >>> I'm not sure what an image-menu making tool would look like. Making an image menu isn't all that hard... it's just that it requires a lot of work.
The easiest way to do it is with ui.imagebuttons, and a custom main menu.
The easiest way to do it is with ui.imagebuttons, and a custom main menu.
Code: Select all
label main_menu:
$ ui.keymap(toggle_fullscreen = renpy.toggle_fullscreen)
$ ui.window(style='mm_root')
$ ui.null()
$ ui.imagebutton("start_idle.png", "start_hover.png", clicked=ui.jumpsoutofcontext("start"), xpos=100, ypos=100)
$ ui.imagebutton("continue_idle.png", "continue_hover.png", clicked=_intra_jumps("_load_screen", "main_game_transition"), xpos=200, ypos=200)
$ ui.imagebutton("prefs_idle.png", "prefs_hover.png", clicked=_intra_jumps("_prefs_screen"), xpos=300, ypos=300)
$ ui.imagebutton("quit_idle.png", "quit_hover.png", clicked=ui.jumps("_quit"), xpos=400, ypos=400)
$ ui.interact(suppress_overlay=True,
suppress_underlay=True,
mouse="mainmenu")
I tend to use map and dictionary as synonyms. One is the abstract data type, and one its itsJake wrote:My Python is rusty, so I can't try and provide example code, but I was under the impression that a 'map' was a functional-programming-style method which applies a function to a list of inputs - and I'm not entirely sure why that would be used here - and a 'dictionary' was a series of key/value pairs of the form:.Code: Select all
myDictionary = { key1:value1, key2:value2, ... , keyn:valuen }
That's right. You really don't want to change the renpy/ or common/ directories, for just this reason.I'm pretty sure the reason it's not recommended that you go changing things in the 'renpy' directory is simply that it prevents you (and anyone trying to run your game) from performing drag-and-drop upgrades of the Ren'Py engine.
Reading this scared me... admittedly, I've just woken up. Just to clarify for everyone... this is purely hypothetical.If you release a game, then there's a bug discovered in Ren'Py where the engine accidentally deletes the user's home directory on Linux platforms when certain really-obscure data conditions are met which happen to have cropped up in your script, then Linux users will want to run your game with the later, fixed version of the engine; normally they'd be able to do this by copying the 'game' directory into a fresh install of the engine and running it from there, but if you fiddle with stuff in any other directories that might break your game. You'll have the same problem if you find you want to upgrade the engine partway through development to take advantage of new features.
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?)
Software > Drama • https://www.patreon.com/renpytom
Re: Creating a new main menu.
I tend to think of Python dictionaries (and .NET Dictionaries, and PHP associative arrays, and so on) as 'mappings', but the use of both in the same sentence in the reference threw me.PyTom wrote: I tend to use map and dictionary as synonyms.
Yeah - I probably should have made that clearer. It's entirely hypothetical, I know of no problems in Ren'Py that do any damage to the user's system at all...PyTom wrote:Reading this scared me... admittedly, I've just woken up. Just to clarify for everyone... this is purely hypothetical.If you release a game, then there's a bug discovered in Ren'Py where the engine accidentally deletes the user's home directory on Linux platforms
I just wanted to use an example that made a really obvious case for why a user might want to upgrade the version of Ren'Py that someone else's game uses. If it was something trivial like "background positioning is off by a pixel or two" then it's far too easy to dismiss it with "well, they can just put up with it or wait 'til I release an upgraded version myself, nobody's going to be that bothered about it that they can't wait for me to re-integrate all my changes with the current source tree", but for something like home directory damage users of the affected platform would be well-advised to upgrade all Ren'Py-based games on their system just in case.
Server error: user 'Jake' not found
Re: Creating a new main menu.
I just woke up, heh... Jake's hypothetical made me wake up really fast, but then I realized it was just a hypothetical.
PyTom -- thank you so much! That's exactly what I was looking for and trying to do... I'm at a slight disadvantage, being new to both Python and Ren'Py, but I had a gut feeling that it had to be possible to do it that way, which seemed a lot simpler and seemed to make sense. Would it be possible to add that to the cookbook? I get the feeling, from looking through the last two years of forum posts, that that might have been what some people were looking for...
PyTom -- thank you so much! That's exactly what I was looking for and trying to do... I'm at a slight disadvantage, being new to both Python and Ren'Py, but I had a gut feeling that it had to be possible to do it that way, which seemed a lot simpler and seemed to make sense. Would it be possible to add that to the cookbook? I get the feeling, from looking through the last two years of forum posts, that that might have been what some people were looking for...
Re: Creating a new main menu.
I guess this question can go here.
Where do I change the "Are you sure you want to quit?" and " Are you sure you want to return to the main menu? This will lose unsaved progress" messages, its pretty easy to change the yes/no buttons but I can´t seem to find where to change the questions.
Where do I change the "Are you sure you want to quit?" and " Are you sure you want to return to the main menu? This will lose unsaved progress" messages, its pretty easy to change the yes/no buttons but I can´t seem to find where to change the questions.
Re: Creating a new main menu.
Well, may be it is not a good idea to resurrect some-years-old threads - the codes and advises might be obsolete...
Anyway, if you want to change all those warning messages, try
http://www.renpy.org/doc/html/screen_sp ... sno-prompt
Anyway, if you want to change all those warning messages, try
Code: Select all
init:
layout.QUIT = "Err, stupid question - R U shure?"
Re: Creating a new main menu.
you´re probably right about the obsolesence, however I didn´t want to open a new treath because there was one already albeit old, I tried that but I do not know where I must pute that in the Yes/No Prompt, can you tell me please?
# Yes/No Prompt
#
# Screen that asks the user a yes or no question.
# http://www.renpy.org/doc/html/screen_sp ... sno-prompt
screen yesno_prompt:
modal True
window:
style "gm_root"
frame:
style_group "yesno"
xfill True
xmargin .05
ypos .1
yanchor 0
ypadding .05
has vbox:
xalign .5
yalign .5
spacing 30
label _(message):
xalign 0.5
hbox:
xalign 0.5
spacing 100
textbutton _("Si") action yes_action
textbutton _("No") action no_action
init -2 python:
style.yesno_button.size_group = "yesno"
style.yesno_label_text.text_align = 0.5
# Yes/No Prompt
#
# Screen that asks the user a yes or no question.
# http://www.renpy.org/doc/html/screen_sp ... sno-prompt
screen yesno_prompt:
modal True
window:
style "gm_root"
frame:
style_group "yesno"
xfill True
xmargin .05
ypos .1
yanchor 0
ypadding .05
has vbox:
xalign .5
yalign .5
spacing 30
label _(message):
xalign 0.5
hbox:
xalign 0.5
spacing 100
textbutton _("Si") action yes_action
textbutton _("No") action no_action
init -2 python:
style.yesno_button.size_group = "yesno"
style.yesno_label_text.text_align = 0.5
Who is online
Users browsing this forum: Google [Bot]