Page 1 of 1

Main Menu changed after getting ALL ends [Solved]

Posted: Mon Mar 26, 2012 2:36 pm
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.

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

Posted: Mon Mar 26, 2012 3:03 pm
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: 

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

Posted: Sat Mar 31, 2012 10:32 am
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?

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

Posted: Sat Mar 31, 2012 7:37 pm
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.

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

Posted: Sun Apr 01, 2012 12:03 pm
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

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

Posted: Sun Apr 01, 2012 8:12 pm
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*

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

Posted: Mon Apr 02, 2012 3:15 am
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