Condition to unlock the gallery at the end of the game.

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
El Caminante
Newbie
Posts: 24
Joined: Fri Aug 14, 2015 4:09 pm
Contact:

Condition to unlock the gallery at the end of the game.

#1 Post by El Caminante »

I been looking and researching what more I can about this, but can not find a clear answer ...

What I seek to make is that I have that button in the main menu heading to the gallery is locked until the game is over.

I gallery ready to use, just need to know how to do to keep hidden the button of the gallery until the game is over.



Please help me... :( :( :( :cry: :cry:

User avatar
PyTom
Ren'Py Creator
Posts: 16096
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: Condition to unlock the gallery at the end of the game.

#2 Post by PyTom »

How are you showing the gallery now? You can make this conditional using code like:

Code: Select all

textbutton "Gallery" action If(persistent.unlock_gallery, Start("gallery"))
(This assumes you use Start("gallery") to show the gallery. Your code might use ShowMenu("gallery") or something else entirely.)

To actually do the unlock, use code like:

Code: Select all

$ persistent.unlock_gallery = True
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

El Caminante
Newbie
Posts: 24
Joined: Fri Aug 14, 2015 4:09 pm
Contact:

Re: Condition to unlock the gallery at the end of the game.

#3 Post by El Caminante »

My code for botton overlooking the gallery I got this:

Code: Select all

imagebutton idle "gui/arrow_idle.png" hover "gui/arrow_right_hover.png" xpos 500 ypos 400 focus_mask True action ShowMenu('hilo')
When you try to attach the code as you gave me gave me an error ....

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/screens.rpy", line 196: u'if' is not a keyword argument or valid child for the imagebutton statement.
    imagebutton idle "gui/arrow_idle.png" hover "gui/arrow_right_hover.png" xpos 500 ypos 400 focus_mask True action if (persistent.unlock_gallery, ShowMenu('hilo'))
                                                                                                                       ^

Ren'Py Version: Ren'Py 6.99.5.602

Post Reply

Who is online

Users browsing this forum: Google [Bot]