Multiple animated main menus using persistent data- 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
User avatar
78909087
Veteran
Posts: 277
Joined: Sat Aug 16, 2014 2:33 pm
Completed: Dungeons and Don't Do It, Wake Up
Projects: Lethe
IRC Nick: Pacermist
Contact:

Multiple animated main menus using persistent data- SOLVED

#1 Post by 78909087 » Sun Mar 22, 2015 9:13 am

Okay, while I know how to change the menu using persistent data, what I don't know is how to give each menu their animated background.
The code I have at the moment (shortened for convenience) is as follows:

Code: Select all

if persistent.ending1 == True:
    image slideshow:
        "1s5.png" with dissolve
        pause 0.07
        "1s6.png" with dissolve
        pause 0.07
        "1s7.png" with dissolve
        pause 0.07
        "1s8.png" with dissolve
        pause 0.07
        "1s5.png" with dissolve
        pause 0.07
        repeat
elif persistent.ending2 == True:
    image slideshow:
        "2s5.png" with dissolve
        pause 0.07
        "2s6.png" with dissolve
        pause 0.07
        "2s7.png" with dissolve
        pause 0.07
        "2s8.png" with dissolve
        pause 0.07
        "2s5.png" with dissolve
        pause 0.07
        repeat
else:
    image slideshow:
        "s5.png" with dissolve
        pause 0.07
        "s6.png" with dissolve
        pause 0.07
        "s7.png" with dissolve
        pause 0.07
        "s8.png" with dissolve
        pause 0.07
        "s5.png" with dissolve
        pause 0.07
        repeat
This is so that, in the options:

Code: Select all

        mm_root = "slideshow",
And in screens:

Code: Select all

screen main_menu():

    tag menu

    if persistent.ending == "Ending 1":
        use main_menu_1
    elif persistent.ending == "Ending 2":
        use main_menu_2
    else:
        use main_menu_default

screen main_menu_default:
    tag menu
    window:
        style "mm_root"
    
    frame:
        style_group "mm"
        xalign .5
        yalign .95
        has hbox
        textbutton _("Load Game") action ShowMenu("load")
        textbutton _("Start") action Start()
        textbutton _("Preferences") action ShowMenu("preferences")
        textbutton _("Quit") action Quit(confirm=False)
    
    
screen main_menu_1:
    tag menu
    window:
        style "mm_root"
    
    frame:
        style_group "mm"
        xalign .5
        yalign .95
        has hbox
        textbutton _("Load Game") action ShowMenu("load")
        if persistent.Understand:
            textbutton _("I Understand") action Start("Understood")
        else:
            textbutton _("Try to Understand") action Start()
        textbutton _("Preferences") action ShowMenu("preferences")
        textbutton _("Quit") action Quit(confirm=False)
        
screen main_menu_2:
    tag menu
    window:
        style "mm_root"
    
    frame:
        style_group "mm"
        xalign .5
        yalign .95
        has hbox
        textbutton _("Load Game") action ShowMenu("load")
        textbutton _("Try Again") action Start()
        textbutton _("Preferences") action ShowMenu("preferences")
        textbutton _("Quit") action Quit(confirm=False)

It's not returning an error- but it's not working in game, either.
Am I putting the 'if' wrong, by shoving it in the code?

Should I link to the 'slideshow' in the screens file?

I'm really lost.


I should also note the menu choice I'm using to test it goes like this:

Code: Select all

    menu:
        "No.":
            $ persistent.ending = "Ending 1"
            $ persistent.ending1 = True
            jump good_ending
        "Yes.": 
            $ persistent.ending = "Ending 2"
            $ persistent.ending2 = True
            $ persistent.Understand = True
            jump bad_ending
I did that to try and make it easier for me to distinguish for my own use... It's a bit clutter-y now.
Last edited by 78909087 on Sun Mar 22, 2015 9:35 am, edited 1 time in total.

User avatar
78909087
Veteran
Posts: 277
Joined: Sat Aug 16, 2014 2:33 pm
Completed: Dungeons and Don't Do It, Wake Up
Projects: Lethe
IRC Nick: Pacermist
Contact:

Re: Multiple animated menus using persistent data- SOLVED

#2 Post by 78909087 » Sun Mar 22, 2015 9:29 am

I solved this with one last desperate attempt. Leaving it up in case anyone else needs help with a similar issue- there is a fix.

User avatar
78909087
Veteran
Posts: 277
Joined: Sat Aug 16, 2014 2:33 pm
Completed: Dungeons and Don't Do It, Wake Up
Projects: Lethe
IRC Nick: Pacermist
Contact:

Re: Multiple animated menus using persistent data- SOLVED

#3 Post by 78909087 » Sun Mar 22, 2015 9:35 am

In script:

Code: Select all

image slideshow1:
    "1s5.png" with dissolve
    pause 0.07
    "1s6.png" with dissolve
    pause 0.07
    "1s7.png" with dissolve
    pause 0.07
    "1s8.png" with dissolve
    pause 0.07
    "1s5.png" with dissolve
    pause 0.07
    repeat
image slideshow2:
    "2s5.png" with dissolve
    pause 0.07
    "2s6.png" with dissolve
    pause 0.07
    "2s7.png" with dissolve
    pause 0.07
    "2s8.png" with dissolve
    pause 0.07
    "2s5.png" with dissolve
    pause 0.07
    repeat
image slideshow:
    "s5.png" with dissolve
    pause 0.07
    "s6.png" with dissolve
    pause 0.07
    "s7.png" with dissolve
    pause 0.07
    "s8.png" with dissolve
    pause 0.07
    "s5.png" with dissolve
    pause 0.07
    repeat
And...

In screens:

Code: Select all

screen main_menu():

    tag menu

    if persistent.ending == "Ending 1":
        use main_menu_1
    elif persistent.ending == "Ending 2":
        use main_menu_2
    else:
        use main_menu_default

screen main_menu_default:
    tag menu
    add "slideshow"
    
    frame:
        style_group "mm"
        xalign .5
        yalign .95
        has hbox
        textbutton _("Load Game") action ShowMenu("load")
        textbutton _("Start") action Start()
        textbutton _("Preferences") action ShowMenu("preferences")
        textbutton _("Quit") action Quit(confirm=False)
    
    
screen main_menu_1:
    tag menu
    add "slideshow1"
    
    frame:
        style_group "mm"
        xalign .5
        yalign .95
        has hbox
        textbutton _("Load Game") action ShowMenu("load")
        if persistent.Understand:
            textbutton _("I Understand") action Start("Understood")
        else:
            textbutton _("Try to Understand") action Start()
        textbutton _("Preferences") action ShowMenu("preferences")
        textbutton _("Quit") action Quit(confirm=False)
        
screen main_menu_2:
    tag menu
    add "slideshow2"
    
    frame:
        style_group "mm"
        xalign .5
        yalign .95
        has hbox
        textbutton _("Load Game") action ShowMenu("load")
        textbutton _("Try Again") action Start()
        textbutton _("Preferences") action ShowMenu("preferences")
        textbutton _("Quit") action Quit(confirm=False)

Post Reply

Who is online

Users browsing this forum: _ticlock_