Custom Menu

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.
Message
Author
Gouka
Regular
Posts: 66
Joined: Thu Feb 01, 2007 1:24 pm
Projects: Demon Wraith
Contact:

Custom Menu

#1 Post by Gouka »

Is there a way to change the buttons of the main menu and in-game menus? I mean instead of using the themes that Ren'py already has.
Check the Chaos Lord development at http://atelieredgeproductions.wordpress.com

EvilDragon
Veteran
Posts: 284
Joined: Fri Dec 28, 2007 5:47 am
Location: Where the Dragons rule!
Contact:

Re: Custom Menu

#2 Post by EvilDragon »

Yes, you can change them with config.main_menu and config.game_menu variables. See here for more info.
Angels of paradise, angels of sacrifice
Please let me be under your wings...

Gouka
Regular
Posts: 66
Joined: Thu Feb 01, 2007 1:24 pm
Projects: Demon Wraith
Contact:

Re: Custom Menu

#3 Post by Gouka »

How should I write the name of the files. I have an example of the button that I want to use.
What would be the command and where should I write it in: Init: or Init-1?
Attachments
button000.png
button000.png (7.06 KiB) Viewed 3501 times
Check the Chaos Lord development at http://atelieredgeproductions.wordpress.com

EvilDragon
Veteran
Posts: 284
Joined: Fri Dec 28, 2007 5:47 am
Location: Where the Dragons rule!
Contact:

Re: Custom Menu

#4 Post by EvilDragon »

For your current example, let's say you have a Main menu set up normally like this:

Code: Select all

config.main_menu = [
        (u"Start Game", "start", "True"),
        (u"Continue Game", _intra_jumps("load_screen", "main_game_transition"), "True"),
        (u"Preferences", _intra_jumps("preferences_screen", "main_game_transition"), "True"),
        (u"Quit", ui.jumps("_quit"), "True")
        ]
Then you would need to convert every text to an imagebutton, like so:

Code: Select all

ui.imagebutton['Start Game']("newgame_idle.png", "newgame_hover.png", clicked=nameoffunction, image_style='image_button_image')
etc. You can also have insensitive_image, activate_image (when you click on it) and others, see here.

I hope I didn't mess something up here, if I did, somebody please correct me, I'm writing this on top of my head ^^'
Angels of paradise, angels of sacrifice
Please let me be under your wings...

JQuartz
Eileen-Class Veteran
Posts: 1265
Joined: Fri Aug 31, 2007 7:02 am
Projects: 0 completed game. Still haven't made any meaningfully completed games...
Contact:

Re: Custom Menu

#5 Post by JQuartz »

I'm not sure how to use EvilDragon's method so I'll just show a different one.
Stick this anywhere in your script,

Code: Select all

init:
    $ style.mm_button[u'Start Game'].hover_foreground=Frame("button000.png", 12, 12)
save and run your game. Hover over start game and there's your button.
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.

EvilDragon
Veteran
Posts: 284
Joined: Fri Dec 28, 2007 5:47 am
Location: Where the Dragons rule!
Contact:

Re: Custom Menu

#6 Post by EvilDragon »

Yes, I thought about that way too, but couldn't find it in the Reference! Use JQuartz's method, mine is wrong! JQuartz, which button states can be used with that style variable?
Angels of paradise, angels of sacrifice
Please let me be under your wings...

User avatar
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: Custom Menu

#7 Post by PyTom »

The preferred way to do image buttons is:

Code: Select all

init python:
    theme.image_buttons({
        "Yes" : ("yes_idle.png", "yes_hover.png", "yes_selected_idle.png", "yes_selected_hover.png", "yes_insensitive.png"),
        "No" : ("no_idle.png", "no_hover.png", "no_selected_idle.png", "no_selected_hover.png", "no_insensitive.png"),
        # ...
    })
I'll point out that each "image" can be an arbitrary displayable, if that's your thing.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

EvilDragon
Veteran
Posts: 284
Joined: Fri Dec 28, 2007 5:47 am
Location: Where the Dragons rule!
Contact:

Re: Custom Menu

#8 Post by EvilDragon »

Using that method, is it possible to assign an image for the button when it's clicked? I reckon one might use this for a "pressed" look of the button.

Also, under quotes goes the name of the textbutton we wish to change, if I got it right?

Is this also possible with config.image_buttons variable?
Angels of paradise, angels of sacrifice
Please let me be under your wings...

Gouka
Regular
Posts: 66
Joined: Thu Feb 01, 2007 1:24 pm
Projects: Demon Wraith
Contact:

Re: Custom Menu

#9 Post by Gouka »

Thanks for helping, but I have some questions.
How can place the other buttons and erase the default Renpy Start Game, Continue game, etc.
I mean I have an image for the button that is not selected and another for when the option is selected.
How can I do this?
example:
Attachments
Start_Game_On.png
Start_Game_On.png (13.54 KiB) Viewed 3288 times
Start_Game_Off.png
Start_Game_Off.png (7.66 KiB) Viewed 3291 times
Check the Chaos Lord development at http://atelieredgeproductions.wordpress.com

EvilDragon
Veteran
Posts: 284
Joined: Fri Dec 28, 2007 5:47 am
Location: Where the Dragons rule!
Contact:

Re: Custom Menu

#10 Post by EvilDragon »

Read PyTom's reply.

You do like this:

Code: Select all

init python:
    theme.image_buttons({
        "Name of the button" : ("button_not_pressed.png", "button_hovered.png", "button_selected.png", "button_selected_and_hovered.png", "button_not_sensitive.png"),
        "Another button" : (order images the same way),
        # ... add other buttons like so
    })
It's important to order the image files correct way. So first you put "idle" image, then "hovered", then "selected", then "selected+hovered", then "insensitive".
Angels of paradise, angels of sacrifice
Please let me be under your wings...

Gouka
Regular
Posts: 66
Joined: Thu Feb 01, 2007 1:24 pm
Projects: Demon Wraith
Contact:

Re: Custom Menu

#11 Post by Gouka »

Can this also be used for the In-game menu and preferences?
Check the Chaos Lord development at http://atelieredgeproductions.wordpress.com

EvilDragon
Veteran
Posts: 284
Joined: Fri Dec 28, 2007 5:47 am
Location: Where the Dragons rule!
Contact:

Re: Custom Menu

#12 Post by EvilDragon »

Of course, you just name the button you wish to change under the quotes. You can change as many buttons as you want, provided that you take care of the correct names of the buttons (watch out for capital letters, spaces etc.)
Angels of paradise, angels of sacrifice
Please let me be under your wings...

Gouka
Regular
Posts: 66
Joined: Thu Feb 01, 2007 1:24 pm
Projects: Demon Wraith
Contact:

Re: Custom Menu

#13 Post by Gouka »

I have a problem it seems that with the code the buttons aren't replaced. Do I have to change anything in the Init -1?
Check the Chaos Lord development at http://atelieredgeproductions.wordpress.com

EvilDragon
Veteran
Posts: 284
Joined: Fri Dec 28, 2007 5:47 am
Location: Where the Dragons rule!
Contact:

Re: Custom Menu

#14 Post by EvilDragon »

I don't know what you're doing wrong, to me PyTom's code works great. At least for main menu buttons, I haven't tried it for game menu buttons.

Try also JQuartz's method, it's fine, too, and it should definitely work with game screen (you just use style.gm_button['nameofbutton'].state).
Angels of paradise, angels of sacrifice
Please let me be under your wings...

Gouka
Regular
Posts: 66
Joined: Thu Feb 01, 2007 1:24 pm
Projects: Demon Wraith
Contact:

Re: Custom Menu

#15 Post by Gouka »

I want to completely customize everything in my game. I have these questions.
With Jquartz menu generator I need the assigned button image to be readable because I can see that beneath the image I can read Start game, continue game and so on. How can I make that disappear?
Is it possible to customize the preferences, that if I can use image buttons and custom bars.

I appreciate the help.
Check the Chaos Lord development at http://atelieredgeproductions.wordpress.com

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Imperf3kt, Majestic-12 [Bot]