Main Menu changed after getting ALL ends [Solved]

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
GeneDNC
Veteran
Posts: 251
Joined: Fri May 13, 2011 6:38 am
Completed: Freezing v1.0
Contact:

Main Menu changed after getting ALL ends [Solved]

#1 Post by GeneDNC »

This is driving me up the wall, and believe me, I went through every tutorial and thread here in the Q's section that I could find. I want an epilogue to become available via a button on the main menu once ALL endings have been reached. Most of the tutorials and things I've found deal with a change after 1 or each separate ending. Anyway, this is the code I'm trying:

Code: Select all

screen main_menu:


    
    # This ensures that any other menu screen is replaced.
    tag menu
    
    if persistent.ending_1 and persistent.ending_2 and persistent.ending_3 and persistent.ending_4 and persistent.ending_5:
        $ persistent.true = True    

        
    if persistent.true = True:    
        use main_menu2
        
    else:
         use main_menu1
        
screen main_menu1:     
    tag menu
        
    # The background of the main menu.
    window:
        style "mm_root"

    # The main menu buttons.
    imagemap:
        ground "mm_idle.png"
        hover "mm_hover.png"
        
        hotspot (648,429,115,54) action Start()
        hotspot (614,541,118,43) action ShowMenu("load")
        hotspot (568,483,186,49) action ShowMenu("preferences")
        hotspot (754,472,122,52) action Help()
        hotspot (744,532,110,50) action ShowMenu("quit1")

screen main_menu2:     
    tag menu
        
    # The background of the main menu.
    window:
        #style "gm_root"
        background "title2.png"

    # The main menu buttons.
    imagemap:
        ground "mm_idle4.png"
        hover "mm_hover2.png"
        
        hotspot (648,429,115,54) action Start()
        hotspot (614,541,118,43) action ShowMenu("load")
        hotspot (568,483,186,49) action ShowMenu("preferences")
        hotspot (754,472,122,52) action Help()
        hotspot (744,532,110,50) action ShowMenu("quit1")
        hotspot (170,468,164,46) action Start("bananas")        
        
init -2 python:

    # Make all the main menu buttons be the same size.
    style.mm_button.size_group = "mm"

Code: Select all

label start:
    $ persistent.ending_1 = False
    $ persistent.ending_2 = False
    $ persistent.ending_3 = False
    $ persistent.ending_4 = False
    $ persistent.ending_5 = False
    $ persistent.true = False

Code: Select all

        k "Nothing."
    
        #"End 1"
        
        $ persistent.ending_1 = True
    
        return
-> with 1 to 5 at the end of each path, before the "return".

The above results in main_menu2, with the "unlockable hotspot" being used permanently, no matter how many times I delete the persistent data. I've also tried another method, but I'll post that if necessary.
This is for my NaNoRenO project so I would greatly appreciate a speedy response. Thanks in advance.
Last edited by GeneDNC on Sun Apr 01, 2012 12:07 pm, edited 1 time in total.

Anima
Veteran
Posts: 448
Joined: Wed Nov 18, 2009 11:17 am
Completed: Loren
Projects: PS2
Location: Germany
Contact:

Re: Main Menu changed after getting ALL ends [Urgent NaNoRen

#2 Post by Anima »

Code: Select all

label start:
    $ persistent.ending_1 = False
    $ persistent.ending_2 = False
    $ persistent.ending_3 = False
    $ persistent.ending_4 = False
    $ persistent.ending_5 = False
    $ persistent.true = False
This code sets all your ending flags to False every time a new game is started. So, the only way to get the epilogue would be to reload a save.

Code: Select all

    if persistent.true = True:   
        use main_menu2
       
    else:
         use main_menu1
You need to use:

Code: Select all

 if persistent.true: 
which is equivalent to:

Code: Select all

 if persistent.true == True: 
Avatar created with this deviation by Crysa
Currently working on:
  • Winterwolves "Planet Stronghold 2" - RPG Framework: Phase III

User avatar
clua
Miko-Class Veteran
Posts: 537
Joined: Sat Dec 12, 2009 1:38 pm
Completed: Stormy Night /The Knife of the Traitor/Charlatans
Projects: The Hurtful Wall /_Salomon/Infurubia
Tumblr: notttt-che
itch: chegovia
Location: In a jar with pirañas
Contact:

Re: Main Menu changed after getting ALL ends [Urgent NaNoRen

#3 Post by clua »

Ah..Im having the same problem...orz..But now with a main menu but with an scene...But the coding is almost the same
There is a way to get that persistent saved instead of errasing it every time you play again?

uhmmm I was searching..maybe..this would help?
♦WIP♦
Infurubia
The hurtful wall
_Salomon

♦COMPLETE♦
+The Knife of the Traitor(Nanoreno 2012)
+Charlatans(Nanoreno 2015)

Dev tumblr
EVN Store

sciencewarrior
Veteran
Posts: 356
Joined: Tue Aug 12, 2008 12:02 pm
Projects: Valentine Square (writer) Spiral Destiny (programmer)
Location: The treacherous Brazilian Rainforest
Contact:

Re: Main Menu changed after getting ALL ends [Urgent NaNoRen

#4 Post by sciencewarrior »

Exactly. Every persistent that you never set is defined as None, which is considered false when used in an if stat. So just remove that assignment after the start label, make sure you are doing "if persistent.variable:" instead of "persistent.variable == False:" and it should work.
Keep your script in your Dropbox folder.
It allows you to share files with your team, keeps backups of previous versions, and is ridiculously easy to use.

GeneDNC
Veteran
Posts: 251
Joined: Fri May 13, 2011 6:38 am
Completed: Freezing v1.0
Contact:

Re: Main Menu changed after getting ALL ends [Urgent NaNoRen

#5 Post by GeneDNC »

Thanks for the help, Anima. It worked like a charm. To others who might have the same problem, the code below is what worked for me:

Code: Select all

        k "Nothing."
    
        #"End 1"
        
        $ persistent.ending_1 = True
    
        return
-> with 1 to 5 at the end of each path, before the "return".

Code: Select all

screen main_menu:
    
    # This ensures that any other menu screen is replaced.
    tag menu
    
    if persistent.ending_1 and persistent.ending_2 and persistent.ending_3 and persistent.ending_4 and persistent.ending_5:
          $ persistent.true = True    
        
    if persistent.true:    
        use main_menu2
        
    else:
         use main_menu1

Soli-chan
Newbie
Posts: 17
Joined: Fri Feb 10, 2012 1:29 pm
Projects: Starlocket, PAPER FACES, Avrilun, Halcyon Days, Macrumbia: Interlude of the Dreaming
Organization: s00t studi0s
Location: En Infelicitas
Contact:

Re: Main Menu changed after getting ALL ends [Solved]

#6 Post by Soli-chan »

@__@ Er, sorry to interject but I kept getting this error:
Line is indented, but the preceding say statement statement does not expect a block. Please check this line's indentation.

Perhaps it's a bit above my ability to understand for now. =S
*was just derping around and wanted to try*

Anima
Veteran
Posts: 448
Joined: Wed Nov 18, 2009 11:17 am
Completed: Loren
Projects: PS2
Location: Germany
Contact:

Re: Main Menu changed after getting ALL ends [Solved]

#7 Post by Anima »

@ GeneDNC
Glad I could be of help.

@ Soli-chan
That means that you have the following problem at that line:

Code: Select all

"Say Satement"
    line of code
In python indentions indicate a block, you can read more about that in the documentation.

To fix it, you simply unindent the second line:

Code: Select all

"Say Satement"
line of code
Avatar created with this deviation by Crysa
Currently working on:
  • Winterwolves "Planet Stronghold 2" - RPG Framework: Phase III

Post Reply

Who is online

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