Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
- Posts: 2
- Joined: Mon Oct 19, 2020 11:47 am
I was wondering if it was possible to have a conditional button in the main menu. So, for instance, if you finish chapter 1, it will remove the "start" button and will replace it with Start Chap. 2 or something similar. Whenever I try using an if statement using a variable named "Chapter2Start" it doesn't allow me to define the variable before the screen loads. How can I fix this? (Can I also make the Chapter 2 Button stay every time you open the game after that?)
- Miko-Class Veteran
- Posts: 838
- Joined: Mon Jan 26, 2009 7:21 pm
Use a persistent. and default.
Defaults are variables that are defined at the init phase, so they are here before the main menu is staged. anyway, persistent return None if not defined (so, no error anyway) and are preserved between launches.
Add this at the very beginning of your script, out of any label.
default persistent.finished_chapt_1 = False
At the end of chapter 1, use
$ persistent.finished_chapt_1 = True
In the main menu you can check the condition easily.
# the chapter 1 button
# the chapter 2 button
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.
10 ? "RENPY"
20 GOTO 10
Users browsing this forum: Google [Bot], M0d1997