I'm New to Ren'Py Questions

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
PyTom
Ren'Py Creator
Posts: 16093
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: I'm New to Ren'Py Questions

#31 Post by PyTom »

You're close. Just precede all the calls to ui functions with $, or put them in a python block.
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

Zephie-chan
Newbie
Posts: 16
Joined: Mon Jan 01, 2007 9:27 pm
Location: United States
Contact:

Re: I'm New to Ren'Py Questions

#32 Post by Zephie-chan »

First off, I must apologize for reviving a dead thread, but making a new topic like, "I'm Now to Ren'Py Questions: The Redux" seemed a bit much. Forgive me.

Secondly, after about a year of not doing anything due to getting my real life situated, and getting a new team together to finish this visual novel I'm working on, I have returned... with more questions. I've gotten everything I've asked in the past to work thus far with very minimal trial and error, but now I have a new problem:

I couldn't find any reference to changing the menu positions in the Reference manual. Maybe I'm not looking hard enough? I don't know. I also searched the forums and I didn't come up with anything tangible. I checked the cookbook and received this in answer to my question:

Code: Select all

init:
    python hide:
        library.main_menu_positions = {
            'Start Game' : dict(xpos=400, ypos=400, xanchor='left', yanchor='top'),
            'Continue Game' : dict(xpos=450, ypos=430, xanchor='left', yanchor='top'),
            'Preferences' : dict(xpos=500, ypos=460, xanchor='left', yanchor='top'),
            'Quit' : dict(xpos=550, ypos=490, xanchor='left', yanchor='top'),
            }
I used this before in the Ren'Py 5.x series and didn't get any problems with it. But now that I'm using the latest version, I get the following error message:

Code: Select all

I'm sorry, but an exception occured while executing your Ren'Py script.
Exception: library.main_menu_positions is not a known configuration variable.
The only thing I can think of is that the command to repositioning the main menu has changed. I figured I would get a faster reply than sifting through all the change logs, and then I had no guarantee that it'd be in there. What's going on? I appreciate any help anyone can give. Thank you!
"The greatest error is not in making a mistake, but not allowing the one who made the mistake a chance to fix it." - corVine
"There is no reason why good can't triumph over evil, if only angels will get organized along the lines of the mafia." Kurt Vonnegut

User avatar
Deji
Cheer Idol; Not Great at Secret Identities
Posts: 1592
Joined: Sat Oct 20, 2007 7:38 pm
Projects: http://bit.ly/2lieZsA
Organization: Sakevisual, Apple Cider, Mystery Parfait
Tumblr: DejiNyucu
Deviantart: DejiNyucu
Location: Chile
Contact:

Re: I'm New to Ren'Py Questions

#33 Post by Deji »

All those things are now defined as "layouts".
This is the wiki article about them:
http://www.renpy.org/wiki/renpy/doc/ref ... ts#Layouts

There are a couple of new Main Menu styles you could use if you don't really like the normal Main menu

You could also create a new layout for you Main Menu, but the information provided on that matter, at least on the wiki, isn't specific
http://www.renpy.org/wiki/renpy/doc/ref ... ew_Layouts

I hope somebody else with more knowledge could help about this, and fix the old cookbook recipe that doens't work anymore.
Image
Tumblr | Twitter
Forever busy :')
When drawing something, anything, USE REFERENCES!! Use your Google-fu!
Don't trust your memory, and don't blindly trust what others teach you either.
Research, observation, analysis, experimentation and practice are the key! (:

User avatar
PyTom
Ren'Py Creator
Posts: 16093
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: I'm New to Ren'Py Questions

#34 Post by PyTom »

As part of a simplification of the way layouts are handled, config.main_menu_positions and config.game_menu_positions went away.

You now need to write a custom main menu for this, which is now relatively easy.

Code: Select all

init -2 python:
    layout.provides('main_menu')

    style.mm_button = Style(style.button, help="main menu button")
    style.mm_button_text = Style(style.button_text, help="main menu button (text)")
    style.mm_button.size_group = "mm"

label main_menu_screen:
    python:
        layout.button(u"Start Game", "mm", clicked=ui.jumpsoutofcontext('start'), xpos=400, ypos=400)
        layout.button(u"Continue Game", "mm", clicked=_intra_jumps("load_screen", "main_game_transition"), xpos=450, ypos=430)
        layout.button(u"Preferences", "mm", clicked=_intra_jumps("preferences_screen", "main_game_transition"), xpos=500, ypos=460),
        layout.button(u"Quit", "mm", clicked=ui.jumps("_quit"), xpos=550, ypos=490)

        ui.interact()
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

User avatar
Deji
Cheer Idol; Not Great at Secret Identities
Posts: 1592
Joined: Sat Oct 20, 2007 7:38 pm
Projects: http://bit.ly/2lieZsA
Organization: Sakevisual, Apple Cider, Mystery Parfait
Tumblr: DejiNyucu
Deviantart: DejiNyucu
Location: Chile
Contact:

Re: I'm New to Ren'Py Questions

#35 Post by Deji »

PyTom wrote:As part of a simplification of the way layouts are handled, config.main_menu_positions and config.game_menu_positions went away.

You now need to write a custom main menu for this, which is now relatively easy.

Code: Select all

init -2 python:
    layout.provides('main_menu')

    style.mm_button = Style(style.button, help="main menu button")
    style.mm_button_text = Style(style.button_text, help="main menu button (text)")
    style.mm_button.size_group = "mm"

label main_menu_screen:
    python:
        layout.button(u"Start Game", "mm", clicked=ui.jumpsoutofcontext('start'), xpos=400, ypos=400)
        layout.button(u"Continue Game", "mm", clicked=_intra_jumps("load_screen", "main_game_transition"), xpos=450, ypos=430)
        layout.button(u"Preferences", "mm", clicked=_intra_jumps("preferences_screen", "main_game_transition"), xpos=500, ypos=460),
        layout.button(u"Quit", "mm", clicked=ui.jumps("_quit"), xpos=550, ypos=490)

        ui.interact()

Would it be ok if I add this code to the Wiki as an example in Defining New Layouts ?
Image
Tumblr | Twitter
Forever busy :')
When drawing something, anything, USE REFERENCES!! Use your Google-fu!
Don't trust your memory, and don't blindly trust what others teach you either.
Research, observation, analysis, experimentation and practice are the key! (:

User avatar
PyTom
Ren'Py Creator
Posts: 16093
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: I'm New to Ren'Py Questions

#36 Post by PyTom »

Yes, that would be more than okay.
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

Post Reply

Who is online

Users browsing this forum: Andredron