On making a text menu option.

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
brigid
Newbie
Posts: 18
Joined: Sun Mar 16, 2008 12:59 pm
Contact:

On making a text menu option.

#1 Post by brigid »

Image

Okay, I've seen menus like this in games but I haven't been able to figure out how to make them myself. And for some reason I can't open the game files to figure it out from there. (Something about the files being .rpyc instead of .rpy maybe?)

Anyway, I'd like to know how these sort of menus are made if that's at all possible.

Thanks.

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: On making a text menu option.

#2 Post by JQuartz »

brigid wrote:And for some reason I can't open the game files to figure it out from there. (Something about the files being .rpyc instead of .rpy maybe?)
Yeah that's right. Only rpy files can be properly read. rpyc files are obsfucated to protect the intellectual property of the creator.
brigid wrote:Anyway, I'd like to know how these sort of menus are made if that's at all possible.
well it was possible in the past but I don't know if it's still possible now (but then again I don't keep myself up to date with the latest Renpy development). I have a inefficient and roundabout method though. Use this only if no one else comes by with a easy method (in the past it was just changing a True to False in options.rpy) and you're desperate for it.

Code: Select all

init python:
    def window_menu():
        if window_menu_show:
            ui.vbox(xpos=0, ypos=500)
            if choice_text1:
                ui.button(clicked=ui.jumps(destination_label1),background='#0000', hover_background='#0000')
                ui.text(choice_text1, color='#fff', hover_color='#f00')
            if choice_text2:
                ui.button(clicked=ui.jumps(destination_label2),background='#0000', hover_background='#0000')
                ui.text(choice_text2, color='#fff', hover_color='#f00')
            ui.close()
    config.overlay_functions.append(window_menu)
And then everytime you want the choice be given, you have to put the following code:

Code: Select all

$ window_menu_show=True
    $ choice_text1='Nothing' #this is what first choice you want to give
    $ destination_label1='start'#this is what label choosing the choice will jump to
    
    ' '#this is what you want to tell the player. Even if you got nothing to tell the player, you still have to put a ' ' here otherwise the text box won't appear.
    $ ui.interact()
Last edited by JQuartz on Sun Jan 18, 2009 10:19 pm, edited 1 time in total.
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.

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: On making a text menu option.

#3 Post by PyTom »

You need to do two things:

1) Ensure you have no calls to layout.button_menu in options.rpy.
2) Inside the call to theme.roundrect, add the parameter button_menu=False. (This may be there already, in which case you should change it.)
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

brigid
Newbie
Posts: 18
Joined: Sun Mar 16, 2008 12:59 pm
Contact:

Re: On making a text menu option.

#4 Post by brigid »

Ah! Thank you very much. ^_^ I'll be trying that.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot]