Using persistent data to swap main menu's background
Posted: Sun Jul 09, 2017 9:11 am
Hi, not good with coding so I'm pretty sure that I'm digging in a wrong direction. The big idea is quite simple - mark unlocked endings then change main menu's background. Each of my endings has:
With the number of the corresponding ending. Then I tried to figure out how to swap the bg, checked the manual but it looked different from my menu's layout so I went to the GUI section of the config and decided to improvise like this:
Plus, added this to option's init to mark variables for the comparision:
No matter what endings I get, the main menu still looks the same using the last, else option (the default one).
Is my persistent data not registering? Or maybe I'm trying to do this in an absolutely wrong way?
Thanks!
Code: Select all
$ persistent.ed1 = 1
Code: Select all
## Main and Game Menus #########################################################
## The images used for the main and game menus.
if persistent.ed1==1 && persistent.ed2==1 && persistent.ed3==1:
define gui.main_menu_background = "images/all.png"
elif persistent.ed1==1 && persistent.ed2==1:
define gui.main_menu_background = "images/ed2ed1.png"
elif persistent.ed2==1 && persistent.ed3==1:
define gui.main_menu_background = "images/ed1ed3.png"
elif persistent.ed2==1 && persistent.ed3==1:
define gui.main_menu_background = "images/ed2ed3.png"
elif persistent.ed1==1:
define gui.main_menu_background = "images/ed1.png"
elif persistent.ed2==1:
define gui.main_menu_background = "images/ed2.png"
elif persistent.ed3==1:
define gui.main_menu_background = "images/ed3.png"
else:
define gui.main_menu_background = "gui/main_menu.png"
Code: Select all
python:
if not persistent.ed1:
persistent.ed1 = 0
if not persistent.ed2:
persistent.ed2 = 0
if not persistent.ed3:
persistent.ed3 = 0
Is my persistent data not registering? Or maybe I'm trying to do this in an absolutely wrong way?
Thanks!