hiding on screen buttons (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
kuroi
Regular
Posts: 129
Joined: Fri Jun 29, 2007 10:50 am
Location: Albuquerque, New Mexico, USA
Contact:

hiding on screen buttons (Solved)

#1 Post by kuroi »

I have been using the On-Screen Buttons code that is posted in the cookbook part of the Renpy site. I really love having the buttons there. Especially the auto button.

However, I find that it doesn't look very good to have the buttons on the screen during cut-scenes or during longer animations. I originally wanted to solve this by adding the buttons directly to the text vbox which renpy uses for the character's speach so that the buttons would only be visible when a character was speaking. Unfortunately, I can't find a way to do this without directly editing the character.rpy file and that seems like it's probubly not the best thing to do.

So, as a second best solution, I've been looking for a way to hide and show these on-screen buttons manually but I can't find which functions I would use to hide the buttons or even to modify them in any way once I have declared them.

Does anyone have any ideas? I'd appreciate anything that would point me in the right direction.

~Thanks
Last edited by kuroi on Tue Apr 21, 2009 12:26 pm, edited 2 times in total.
President, Planner, and Programmer for Kuroi Games!

Dusty
Regular
Posts: 126
Joined: Fri Jul 25, 2008 11:51 pm
Contact:

Re: hiding on screen buttons

#2 Post by Dusty »

Code: Select all

init python:

    # Give us some space on the right side of the screen.
    style.window.right_padding = 100

    def toggle_skipping():
        config.skipping = not config.skipping

    show_button_game_menu = True

    def button_game_menu():
        if show_button_game_menu:
            # to save typing
            ccinc = renpy.curried_call_in_new_context
            ui.vbox(xpos=0.99, ypos=0.98, xanchor='right', yanchor='bottom')
            ui.textbutton("Skip", clicked=toggle_skipping, xminimum=80)
            ui.textbutton("Save", clicked=ccinc("_game_menu_save"), xminimum=80)
            ui.textbutton("Load", clicked=ccinc("_game_menu_load"), xminimum=80)
            ui.textbutton("Prefs", clicked=ccinc("_game_menu_preferences"), xminimum=80)
            ui.close()

    config.overlay_functions.append(button_game_menu)
If that's the code you're using, well, you see the "if show_button_game_menu:" thing at the beginning? That tells the computer to only use the buttons if the value of "show_button_game_menu" is True.

So if you wanted to disable the buttons, you could just write "$ show_button_game_menu = False", and if you wanted to re-enable them, you could write "$ show_button_game_menu = True".

User avatar
kuroi
Regular
Posts: 129
Joined: Fri Jun 29, 2007 10:50 am
Location: Albuquerque, New Mexico, USA
Contact:

Re: hiding on screen buttons

#3 Post by kuroi »

Yay! Thank you so much!! That was the last thing I needed to figure out before I put out my game! you're the best~
President, Planner, and Programmer for Kuroi Games!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]