Help with the customization of the menu [solved]

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.
Post Reply
Message
Author
User avatar
Meg'
Regular
Posts: 185
Joined: Tue Sep 27, 2011 10:37 am
Projects: Anges Démoniaques, Gang (Alex & Hugo), Le passé dans les veines
Location: France
Contact:

Help with the customization of the menu [solved]

#1 Post by Meg' »

Hi !

I know there is a tutorial about customizing the menu, but I really don’t get it. I did understand how to change the screen of the menu when we launch the game, but I also want to customize the buttons.

Well, I better show some pictures to be understood :D

This is how I want that it looks like ==>

Image

And for each button, I have a different file :
ImageImageImageImageImage
I can separate the buttons from the background picture. It’s better if I do it that way or can it also works like that ?

I’m surely the number xxxxx to ask help for the customization of the menu, but I think it’s not so easy even with tutorials.

Thanks in advance for your help :wink:
Last edited by Meg' on Thu Oct 27, 2011 12:10 pm, edited 3 times in total.

User avatar
Gear
Miko-Class Veteran
Posts: 764
Joined: Tue Apr 05, 2011 10:15 pm
Projects: Tempestus Sum
Organization: Xenokos Interactive
IRC Nick: Gear
Skype: Skye.Gear
Location: Grand Prairie, TX
Contact:

Re: Help with the customization of the menu

#2 Post by Gear »

Seems like an imagemap is a good choice for you. Create one image of what the entire screen looks like when you're not hovering over a button, then an image of all the buttons highlighted. The former will be your 'ground' image, and the latter will be the 'hover' image. Then you can use the imagemap tutorial to learn how to set the co-ordinates to make the buttons do whatever you wish.
The best reason to get up in the morning is to outdo yourself: to do it better than you've ever done it before. But if you haven't done it better by nightfall... look at your globe and pick a spot: it's always morning somewhere.

Soraminako
Veteran
Posts: 277
Joined: Sun Sep 04, 2011 1:36 am
Projects: A thingie without a title. With messy code.
Contact:

Re: Help with the customization of the menu

#3 Post by Soraminako »

There's an awesome tutorial on it in this thread: http://lemmasoft.renai.us/forums/viewto ... f=8&t=9812
(I drew my avatar especially to express the scary feeling I get from the code as I type it... XD)

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: Help with the customization of the menu

#4 Post by Aleema »

If you're struggling with the text part of the tutorial, download the game I attached. It has an imagemap main menu. Look at the images and the code that comprise it for a better idea of what you need to do.

User avatar
Meg'
Regular
Posts: 185
Joined: Tue Sep 27, 2011 10:37 am
Projects: Anges Démoniaques, Gang (Alex & Hugo), Le passé dans les veines
Location: France
Contact:

Re: Help with the customization of the menu

#5 Post by Meg' »

Gear > Thanks for your advice. I tried that but got an error. I will try it with the game attached by Aleema ^^

Soraminako > Yes, I saw that. That's why I precised in my post that even though I tried to follow the tutorial, I didn't succeed in doing what I wanted. You can imagine that the tutorial is on my favorites, I already used it to change the background of the main menu :D

Aleema > That's a good idea ! And it will surely be easier that way for me. I'll try that and say if it worked or not.
Thanks a lot ! :wink:

Edit :

It seems I'm not fit to do programmation xD I got an error again...
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/screens.rpy", line 181: u'jeu' is not a keyword argument or valid child for the hotspot statement.
hotspot (8, 200, 78, 78) clicked Nouveau jeu
^

File "game/screens.rpy", line 194: invalid syntax
window:
^


Ren'Py Version: Ren'Py 6.13.7.1646
I guess I did something totally wrong. Well I tried to change the "window:" term into "window" only but that didn't work... I'm about to lose it. I read the tutorial again and again...

Well... Help again ? :cry:

User avatar
fenol
Regular
Posts: 69
Joined: Sat Aug 27, 2011 10:33 am
Projects: Choroumachi | Vasileio
Organization: Zerorange
Deviantart: fenolijuna
Skype: fenol.ijuna
Soundcloud: fenol-ijuna
Contact:

Re: Help with the customization of the menu

#6 Post by fenol »

Code: Select all

File "game/screens.rpy", line 181: u'jeu' is not a keyword argument or valid child for the hotspot statement.
    hotspot (8, 200, 78, 78) clicked Nouveau jeu
clicked Nouveau jeu? i think this is where you get it wrong.

just copy this and and changed the hotspot with yours.

Code: Select all

screen main_menu:

    tag menu

    window:
        style "mm_root"
        
    imagemap:
        ground "main_menu_idle.jpg"
        hover "main_menu_hover.jpg"
        
        hotspot (0,350,171,35) action Start()
        hotspot (0,399,202,35) action ShowMenu("load")
        hotspot (0,447,154,35) action ShowMenu("preferences")
        hotspot (0,493,196,35) action ShowMenu("bonus")
        hotspot (0,540,154,35) action Quit(confirm=False)

init -2 python:

    style.mm_button.size_group = "mm"
do not changed anything except hotspot. and it will works. :)
Image
[ PIXIV ] [ deviantArt ]

Øp!

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: Help with the customization of the menu

#7 Post by Aleema »

First thing people learn about coding is that it's rarely forgiving. It needs to be written exactly how it wants. This coding language is very sensitive to indentation, since that's the only way it can tell where some things start and stop. Make sure your text looks aligned exactly like what fenol posted.

The actions need to be exactly the same. That's the only way Ren'Py can tell what to do. Those are keywords for the code, NOT what the buttons says. What the buttons says needs to be on the imagemap image, not the code.
So your:

Code: Select all

hotspot (8, 200, 78, 78) clicked Nouveau jeu
Needs to go back to:

Code: Select all

hotspot (8, 200, 78, 78) action Start()

User avatar
Meg'
Regular
Posts: 185
Joined: Tue Sep 27, 2011 10:37 am
Projects: Anges Démoniaques, Gang (Alex & Hugo), Le passé dans les veines
Location: France
Contact:

Re: Help with the customization of the menu

#8 Post by Meg' »

Thanks for your help ! It works ! All that's left for me is to find the right coordinates :D

Edit : When I tried to locate the coordinates with the location picker of ren'py, here is what I got ==>

I'm sorry, but an uncaught exception occurred.
While running game code:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)

-- Full Traceback ------------------------------------------------------------

Full traceback:
File "C:\Users\Meg\Downloads\renpy-6.13.7\renpy\execution.py", line 261, in run
File "C:\Users\Meg\Downloads\renpy-6.13.7\renpy\ast.py", line 630, in execute
File "C:\Users\Meg\Downloads\renpy-6.13.7\renpy\python.py", line 978, in py_exec_bytecode
File "common/_developer.rpym", line 458, in <module>
File "C:\Users\Meg\Downloads\renpy-6.13.7\renpy\ui.py", line 435, in __call__
File "C:\Users\Meg\Downloads\renpy-6.13.7\renpy\text\text.py", line 1033, in __init__
File "C:\Users\Meg\Downloads\renpy-6.13.7\renpy\text\text.py", line 1078, in set_text
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)

Windows-Vista-6.0.6002-SP2
Ren'Py 6.13.7.1646
Is it something that I did wrong or is it a bug from the game... ? Or of ren'py ? :o

Post Reply

Who is online

Users browsing this forum: Mica