[Solved] Disabling buttons temporarily

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
Echorid
Newbie
Posts: 9
Joined: Sun Jun 23, 2013 9:20 am
Contact:

[Solved] Disabling buttons temporarily

#1 Post by Echorid » Sun Jun 23, 2013 10:12 pm

Getting stuck is something I seem to be getting very, very good at.

Now I would like to temporarily remove buttons in their entirety. I followed the tutorial for disabling buttons (http://www.renpy.org/wiki/renpy/doc/coo ... _Game_Menu) and ended up with this:

screens.rpy

Code: Select all

screen managment_screen:

init python:
    
    avatar_button = True

    def my_button_function():
        ui.vbox(xpos=0, ypos=.07, xanchor='left')
        if avatar_button:
            ui.textbutton("Avatar", clicked=ui.jumps("avatar_screen"), xminimum=218, yminimum=40)
            ui.close()

    config.overlay_functions.append(my_button_function) 
script.rpy:

Code: Select all

label avatar_screen:
    $ show_button_avatar_button = False
    call screen managment_screen
Unfortunately it doesn't seem to do anything. I am very new to both ren'py, python and programming in its entirety so you'll have to excuse me if I'm doing something silly.

While I wait, I shall silly walk my way to bed. Good night folks!
Last edited by Echorid on Mon Jun 24, 2013 12:44 pm, edited 1 time in total.

pwisaguacate
Veteran
Posts: 356
Joined: Mon Mar 11, 2013 11:03 pm
Contact:

Re: Disabling buttons temporarily

#2 Post by pwisaguacate » Sun Jun 23, 2013 10:57 pm

You weren't controlling the same variable:

Code: Select all

init python:
    avatar_button = True
    [...]

label avatar_screen:
    $ avatar_button = False # not show_button_avatar_button

Echorid
Newbie
Posts: 9
Joined: Sun Jun 23, 2013 9:20 am
Contact:

Re: Disabling buttons temporarily

#3 Post by Echorid » Mon Jun 24, 2013 7:43 am

Hahaha, I need to take breaks more often so I do not commit such dumb mistakes :lol:

Thanks a bunch pwisaguacate :)

Post Reply

Who is online

Users browsing this forum: _ticlock_