Showing More Menu Options based on Persistant Data

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
SelLi
Veteran
Posts: 486
Joined: Fri Apr 27, 2012 4:49 pm
Completed: Memory Mage
Projects: A Lily from the Lightless Water, The Silent Column, A Castle on an Island
Deviantart: SelLillianna
itch: SelLillianna
Location: Canada
Contact:

Showing More Menu Options based on Persistant Data

#1 Post by SelLi » Sun Oct 23, 2022 1:34 pm

Hi there. This question has almost certainly been asked before, but it seems I don't know how to phrase it well enough to search for it effectively. Basically I'm wanting to "unlock", "show", or "add" items to a menu based on variables. Here's the basic situation I'm thinking of:

The MC, depending on choices made in game, spends time with one of several heroines. After a time skip, the MC chooses who to look up. There are time-travel elements at play, and the MC remembers each heroine he's been with, achieved with persistent data. As the player replays the game and is with more heroines, those heroines are added to the list.

I tried this method, but it didn't work. Hopefully you know what I mean:

Code: Select all

menu:
    "Who should I see...?"
    if persistant.emily == True:
        "Emily":
            jump LB_Emily_After
    if persistant.toto == True:
        "Toto":
            jump LB_Toto_After
    if persistant.mia == True:
        "Mia":
            jump LB_Mia_After
Do you know how to do this properly?
Thank you for any help. Please remember to have a nice day. :heart:

User avatar
laure44
Regular
Posts: 60
Joined: Mon Mar 08, 2021 10:55 pm
Projects: Arkan'sTower, Gemshine Lorelei!
Location: France
Contact:

Re: Showing More Menu Options based on Persistant Data

#2 Post by laure44 » Sun Oct 23, 2022 1:46 pm

Code: Select all

    menu:
        "Who should I see...?"
        "Emily" if persistent.emily:
            jump LB_Emily_After
        "Toto" if persistent.toto:
            jump LB_Toto_After
        "Mia" if persistent.mia:
            jump LB_Mia_After
Careful though, it is 'persistent', not 'persistant'. :)

Post Reply

Who is online

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