Persistent Data
Posted: Sun Jun 22, 2014 11:44 am
I'm having trouble with a bit of persistent data. I have a persistent variable that I'm using to control if on the splashscreen the reader will begin a new game or be brought to the menu. I also use it to see if the reader has seen the whole prologue. I start the game and it automatically jumps to the "start" label. Then I read through the story and am sent to the main menu. From the main menu I start a new game it remembers that I've already seen the prologue and gives me the option to skip what I've read. I than close the program and start fresh.
I have a line that shows me what my "persistent.op_unlocked" is set to before I start the if statement. When I close the game and start fresh it says that the variable is set to "False" even though I set it to "True" after the prologue. Any ideas on what could be causing the issue? Could it be that I've set the variable up original in a "init -2"?
I have a line that shows me what my "persistent.op_unlocked" is set to before I start the if statement. When I close the game and start fresh it says that the variable is set to "False" even though I set it to "True" after the prologue. Any ideas on what could be causing the issue? Could it be that I've set the variable up original in a "init -2"?
Code: Select all
init -2:
$ persistent.op_unlocked = False
# The game starts here.
label splashscreen:
#Title screen.
$ renpy.pause(0)
scene black
"Title Here"
#Go to start if it's their first time playing and seeing the full opening.
"[persistent.op_unlocked]"
if persistent.op_unlocked == False:
jump start
return
label start:
scene black with fade
"Prestory here."
# Makes a skip option so those who've seen the whole opening can skip it.
if persistent.op_unlocked == True:
show text "You seen the opening, Choose to skip the prologue." at hc
menu:
"Skip":
call Prologue
"Don't skip":
pass
else:
call Prologue
#Persistent set to True here so if the opening is not fully scene they don't have the skip option.
#When game is opened again spalshscreen will go to the main menu and not jump to start.
$ persistent.op_unlocked = True
jump Chapter1
# The story continues...