[Solved] Main Menu Changes to Last Variation Made
Posted: Fri May 07, 2021 2:49 am
I will admit that when it comes to coding in Ren'py, stuff beyond the basics is still new to me, but this has had me confused for a little while now. I am implementing different variations of my game's title screen depending on the endings you have achieved. It accumulates, so I account for all combinations. The problem is that, in order to test this feature from the beginning, I had to use the delete persistent in order to reset the parameters. Everything else tied to a persistent variable works fine still, but my screens.rpy part of the code has stopped working right for whatever reason. Here is the code at length, the tldr is just below it.
What I want to happen is the title screen to change based on the parameters met, but what ends up happening is that the title screen will only ever show the main menu variation that is written last regardless of the parameters that have been met. I tried this with another version of the program and the exact same issue happened after deleting the persistent variables. What am I doing wrong? Any help would be greatly appreciated. Thank you very much.
Code: Select all
screen main_menu:
if persistent.Tau_GoodEnd == True and persistent.Ru_GoodEnd == False and persistent.Jen_GoodEnd == False:
use main_menu_1t
elif persistent.Tau_GoodEnd == False and persistent.Ru_GoodEnd == False and persistent.Jen_GoodEnd == True:
use main_menu_1j
elif persistent.Tau_GoodEnd == False and persistent.Ru_GoodEnd == True and persistent.Jen_GoodEnd == False:
use main_menu_1r
else:
use main_menu_0
#Main Menu change after ending
screen main_menu_0():
## This ensures that any other menu screen is replaced.
tag menu
imagemap:
ground "main_menu.png"
style_prefix "main_menu"
add gui.main_menu_background
## This empty frame darkens the main menu.
frame:
pass
## The use statement includes another screen inside this one. The actual
## contents of the main menu are in the navigation screen.
textbutton _("{size=45}START GAME{/size}") action Start() yalign 0.45 xalign 0.05 text_outlines [ (2, "#202020", absolute (1), 1) ] activate_sound "bellclick.mp3" hover_sound "bellhover.mp3"
textbutton _("{size=45}LOAD GAME{/size}") action ShowMenu("load") yalign 0.55 xalign 0.05 text_outlines [ (2, "#202020", absolute (1), 1) ] activate_sound "bellclick.mp3" hover_sound "bellhover.mp3"
textbutton _("{size=45}SETTINGS{/size}") action ShowMenu("preferences") yalign 0.65 xalign 0.05 text_outlines [ (2, "#202020", absolute (1), 1) ] activate_sound "bellclick.mp3" hover_sound "bellhover.mp3"
textbutton _("{size=45}QUIT GAME{/size}") action Quit(confirm=not main_menu) yalign 0.75 xalign 0.05 text_outlines [ (2, "#202020", absolute (1), 1) ] activate_sound "bellclick.mp3" hover_sound "bellhover.mp3"
if gui.show_name:
vbox:
text "[config.name!t]":
style "main_menu_title"
text "[config.version]":
style "main_menu_version"
transform logoin:
style main_menu_frame is empty
style main_menu_vbox is vbox
style main_menu_text is gui_text
style main_menu_title is main_menu_text
style main_menu_version is main_menu_text
style main_menu_frame:
xsize 420
yfill True
background "gui/overlay/main_menu.png"
style main_menu_vbox:
xalign 1.0
xoffset -30
xmaximum 1200
yalign 1.0
yoffset -30
style main_menu_text:
properties gui.text_properties("main_menu", accent=True)
style main_menu_title:
properties gui.text_properties("title")
style main_menu_version:
properties gui.text_properties("version")
screen main_menu_1t():
## This ensures that any other menu screen is replaced.
tag menu
imagemap:
ground "main_menu.png"
style_prefix "main_menu"
add gui.main_menu_background
## This empty frame darkens the main menu.
frame:
pass
## The use statement includes another screen inside this one. The actual
## contents of the main menu are in the navigation screen.
textbutton _("{size=45}START GAME{/size}") action Start() yalign 0.45 xalign 0.05 text_outlines [ (2, "#202020", absolute (1), 1) ] activate_sound "bellclick.mp3" hover_sound "bellhover.mp3"
textbutton _("{size=45}LOAD GAME{/size}") action ShowMenu("load") yalign 0.55 xalign 0.05 text_outlines [ (2, "#202020", absolute (1), 1) ] activate_sound "bellclick.mp3" hover_sound "bellhover.mp3"
textbutton _("{size=45}SETTINGS{/size}") action ShowMenu("preferences") yalign 0.65 xalign 0.05 text_outlines [ (2, "#202020", absolute (1), 1) ] activate_sound "bellclick.mp3" hover_sound "bellhover.mp3"
textbutton _("{size=45}QUIT GAME{/size}") action Quit(confirm=not main_menu) yalign 0.75 xalign 0.05 text_outlines [ (2, "#202020", absolute (1), 1) ] activate_sound "bellclick.mp3" hover_sound "bellhover.mp3"
if gui.show_name:
vbox:
text "[config.name!t]":
style "main_menu_title"
text "[config.version]":
style "main_menu_version"
transform logoin:
style main_menu_frame is empty
style main_menu_vbox is vbox
style main_menu_text is gui_text
style main_menu_title is main_menu_text
style main_menu_version is main_menu_text
style main_menu_frame:
xsize 420
yfill True
background "gui/overlay/main_menu_tau.png"
style main_menu_vbox:
xalign 1.0
xoffset -30
xmaximum 1200
yalign 1.0
yoffset -30
style main_menu_text:
properties gui.text_properties("main_menu", accent=True)
style main_menu_title:
properties gui.text_properties("title")
style main_menu_version:
properties gui.text_properties("version")
#Jen Good End Only
screen main_menu_1j():
## This ensures that any other menu screen is replaced.
tag menu
imagemap:
ground "main_menu.png"
style_prefix "main_menu"
add gui.main_menu_background
## This empty frame darkens the main menu.
frame:
pass
## The use statement includes another screen inside this one. The actual
## contents of the main menu are in the navigation screen.
textbutton _("{size=45}START GAME{/size}") action Start() yalign 0.45 xalign 0.05 text_outlines [ (2, "#202020", absolute (1), 1) ] activate_sound "bellclick.mp3" hover_sound "bellhover.mp3"
textbutton _("{size=45}LOAD GAME{/size}") action ShowMenu("load") yalign 0.55 xalign 0.05 text_outlines [ (2, "#202020", absolute (1), 1) ] activate_sound "bellclick.mp3" hover_sound "bellhover.mp3"
textbutton _("{size=45}SETTINGS{/size}") action ShowMenu("preferences") yalign 0.65 xalign 0.05 text_outlines [ (2, "#202020", absolute (1), 1) ] activate_sound "bellclick.mp3" hover_sound "bellhover.mp3"
textbutton _("{size=45}QUIT GAME{/size}") action Quit(confirm=not main_menu) yalign 0.75 xalign 0.05 text_outlines [ (2, "#202020", absolute (1), 1) ] activate_sound "bellclick.mp3" hover_sound "bellhover.mp3"
if gui.show_name:
vbox:
text "[config.name!t]":
style "main_menu_title"
text "[config.version]":
style "main_menu_version"
transform logoin:
style main_menu_frame is empty
style main_menu_vbox is vbox
style main_menu_text is gui_text
style main_menu_title is main_menu_text
style main_menu_version is main_menu_text
style main_menu_frame:
xsize 420
yfill True
background "gui/overlay/main_menu_jen.png"
style main_menu_vbox:
xalign 1.0
xoffset -30
xmaximum 1200
yalign 1.0
yoffset -30
style main_menu_text:
properties gui.text_properties("main_menu", accent=True)
style main_menu_title:
properties gui.text_properties("title")
style main_menu_version:
properties gui.text_properties("version")
#Ru Good End Only
screen main_menu_1r():
## This ensures that any other menu screen is replaced.
tag menu
imagemap:
ground "main_menu.png"
style_prefix "main_menu"
add gui.main_menu_background
## This empty frame darkens the main menu.
frame:
pass
## The use statement includes another screen inside this one. The actual
## contents of the main menu are in the navigation screen.
textbutton _("{size=45}START GAME{/size}") action Start() yalign 0.45 xalign 0.05 text_outlines [ (2, "#202020", absolute (1), 1) ] activate_sound "bellclick.mp3" hover_sound "bellhover.mp3"
textbutton _("{size=45}LOAD GAME{/size}") action ShowMenu("load") yalign 0.55 xalign 0.05 text_outlines [ (2, "#202020", absolute (1), 1) ] activate_sound "bellclick.mp3" hover_sound "bellhover.mp3"
textbutton _("{size=45}SETTINGS{/size}") action ShowMenu("preferences") yalign 0.65 xalign 0.05 text_outlines [ (2, "#202020", absolute (1), 1) ] activate_sound "bellclick.mp3" hover_sound "bellhover.mp3"
textbutton _("{size=45}QUIT GAME{/size}") action Quit(confirm=not main_menu) yalign 0.75 xalign 0.05 text_outlines [ (2, "#202020", absolute (1), 1) ] activate_sound "bellclick.mp3" hover_sound "bellhover.mp3"
if gui.show_name:
vbox:
text "[config.name!t]":
style "main_menu_title"
text "[config.version]":
style "main_menu_version"
transform logoin:
style main_menu_frame is empty
style main_menu_vbox is vbox
style main_menu_text is gui_text
style main_menu_title is main_menu_text
style main_menu_version is main_menu_text
style main_menu_frame:
xsize 420
yfill True
background "gui/overlay/main_menu_Ru.png"
style main_menu_vbox:
xalign 1.0
xoffset -30
xmaximum 1200
yalign 1.0
yoffset -30
style main_menu_text:
properties gui.text_properties("main_menu", accent=True)
style main_menu_title:
properties gui.text_properties("title")
style main_menu_version:
properties gui.text_properties("version")