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
User avatar
Vatina
Miko-Class Veteran
Posts: 862
Joined: Mon May 08, 2006 2:49 am
Completed: Blue Rose, AO: Broken Memories, My Eternal Rival, Dust
Projects: AO: Fallen Star
Organization: White Cat
IRC Nick: Vatina
Tumblr: vatinyan
Deviantart: Vatina
itch: whitecat
Contact:

Re: Custom Menu

#16 Post by Vatina » Sun Nov 16, 2008 2:06 pm

EvilDragon wrote: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".


I've tried this to customize my own menu, but all I get is a traceback with this message: AttributeError: 'RevertableObject' object has no attribute 'image_buttons'

I have the newest renpy. Is my options code just outdated or something? Or is there something in all the code examples I have read that I just don't get? (In all honesty, I don't get any of this imagemap stuff... so I'm just trying to paste in what everyone else says. I'm too dumb for the tutorial it seems :P )

Here is the full traceback in case you need it:

Code: Select all

I'm sorry, but an exception occured while executing your Ren'Py
script.

AttributeError: 'RevertableObject' object has no attribute 'image_buttons'

While executing init code:
 - script at line 3 of C:\Documents and Settings\Lonnie Brandt\My Documents\Andet\OEL vn\renpy-6.8.0\glass_wings/game/script.rpy
 - python at line 4 of C:\Documents and Settings\Lonnie Brandt\My Documents\Andet\OEL vn\renpy-6.8.0\glass_wings/game/script.rpy.

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

  File "C:\Documents and Settings\****\My Documents\Andet\OEL vn\renpy-6.8.0\renpy\bootstrap.py", line 247, in bootstrap
  File "C:\Documents and Settings\****\My Documents\Andet\OEL vn\renpy-6.8.0\renpy\main.py", line 253, in main
  File "C:\Documents and Settings\****\My Documents\Andet\OEL vn\renpy-6.8.0\renpy\execution.py", line 199, in run
  File "C:\Documents and Settings\****\My Documents\Andet\OEL vn\renpy-6.8.0\renpy\ast.py", line 554, in execute
  File "C:\Documents and Settings\****\My Documents\Andet\OEL vn\renpy-6.8.0\renpy\python.py", line 880, in py_exec_bytecode
  File "C:\Documents and Settings\****\My Documents\Andet\OEL vn\renpy-6.8.0\glass_wings/game/script.rpy", line 4, in <module>
AttributeError: 'RevertableObject' object has no attribute 'image_buttons'

While executing init code:

Ren'Py Version: Ren'Py 6.8.0f

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

Re: Custom Menu

#17 Post by PyTom » Sun Nov 16, 2008 2:35 pm

Are you in compat mode (either by calling layout.compat, or by setting config.script_version)? Alternatively, do you somehow define theme yourself?

Also, image_buttons is different from image_maps. The latter is newer, and is probably easier to use for someone with an artistic bent.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
Vatina
Miko-Class Veteran
Posts: 862
Joined: Mon May 08, 2006 2:49 am
Completed: Blue Rose, AO: Broken Memories, My Eternal Rival, Dust
Projects: AO: Fallen Star
Organization: White Cat
IRC Nick: Vatina
Tumblr: vatinyan
Deviantart: Vatina
itch: whitecat
Contact:

Re: Custom Menu

#18 Post by Vatina » Sun Nov 23, 2008 1:25 pm

Oh yeah, image buttons ^^;

About compat mode - no I don't think so. I've tried searching through my scripts with both those commands, and nothing turned up. Although I seem to remember something about that quite a while ago when my cg gallery code didn't work together with a new renpy version, before a fix came out for that. I wonder if I removed it again after the fix? Or if this is even related?

Meh... better try again, I guess.



EDIT: No wait! I found this in my "New Gallery" code:

Code: Select all

init -1 python hide:
    layout.compat()
Is that why it's not working?

EDIT2: Nevermind - I updated the gallery code and removed compat mode. Now it works :) Thanks.

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

Re: Custom Menu

#19 Post by Gouka » Thu Nov 27, 2008 7:17 pm

I tried your code Pytom but it doesn't seem to work.
I want my main menu to look something like this:

what is the full code?

(Please be patient with me. I'm new at this)
Attachments
imagemap_main_menu.jpg
Check the Chaos Lord development at http://atelieredgeproductions.wordpress.com

User avatar
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

#20 Post by JQuartz » Mon Jan 12, 2009 3:21 pm

Gouka wrote:I want my main menu to look something like this:

what is the full code?
(Shameless promo):Use the main menu generator! I cpmpleted it so it can make transparent buttons as well (press change frame then change solid color then type 0000)
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.

Post Reply

Who is online

Users browsing this forum: Ocelot