(SOLVED) Hide Gallery Until Player Completes A Route

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
amaturemanga
Regular
Posts: 97
Joined: Sun Mar 08, 2015 6:55 pm
Deviantart: amaturemanga
Skype: amature.manga
Contact:

(SOLVED) Hide Gallery Until Player Completes A Route

#1 Post by amaturemanga »

Hello im trying to modify my main menu so that the option on the main menu to go to the Gallery screen is not visible as an option on the main menu until the player completes a route. I managed to do that sort of by going to my script creating the variable completedRoutes and setting it to 0

Code: Select all

init:
    $ completedRoutes = 0
then i went to my navigation screen and added this if statement

Code: Select all

 if completedRoutes > 0:
            
            textbutton _("Gallery") action NullAction()
        
you'll notice for now i set it to NullAction as right now i wanted to just make it so it appears only when completed routes is greater then 0. In my script i added this code so that completedRoutes = 1

Code: Select all

scene black
    e "Hello World!"
    $ completedRoutes += 1

    return
But when it returns to the main menu Gallery is still not visible. Not sure what im doing wrong. Thanks in advance.
Last edited by amaturemanga on Wed Aug 15, 2018 3:40 pm, edited 1 time in total.

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Hide Gallery Until Player Completes A Route

#2 Post by Per K Grok »

amaturemanga wrote: Wed Aug 15, 2018 1:20 pm ...
But when it returns to the main menu Gallery is still not visible. Not sure what im doing wrong. Thanks in advance.
When you step back to the main menu you step out of the game you was playing and values saved during that play is no longer available to you. So competedRoutes is now at its original value (0)

You could possibly use persistent data.

User avatar
amaturemanga
Regular
Posts: 97
Joined: Sun Mar 08, 2015 6:55 pm
Deviantart: amaturemanga
Skype: amature.manga
Contact:

Re: Hide Gallery Until Player Completes A Route

#3 Post by amaturemanga »

Per K Grok wrote: Wed Aug 15, 2018 2:30 pm
amaturemanga wrote: Wed Aug 15, 2018 1:20 pm ...
But when it returns to the main menu Gallery is still not visible. Not sure what im doing wrong. Thanks in advance.
When you step back to the main menu you step out of the game you was playing and values saved during that play is no longer available to you. So competedRoutes is now at its original value (0)

You could possibly use persistent data.
how would i set up persistent data

User avatar
amaturemanga
Regular
Posts: 97
Joined: Sun Mar 08, 2015 6:55 pm
Deviantart: amaturemanga
Skype: amature.manga
Contact:

Re: Hide Gallery Until Player Completes A Route

#4 Post by amaturemanga »

Never mind i got it

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], SONTSE