Persistent data Unlocking Button.

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
KairuKyun
Veteran
Posts: 286
Joined: Thu Feb 12, 2015 4:10 pm
Completed: No One But You, Catch Canvas, Sickness, Written in the Sky, Wander no more, Warped Reality
Projects: Warped Reality
Organization: Unwonted Studios
IRC Nick: Kairu_kyun
Tumblr: karamuchan
Contact:

Persistent data Unlocking Button.

#1 Post by KairuKyun » Sun Apr 26, 2015 1:12 am

Okay in my code I have this at the end of my label:

Code: Select all

    
    $ persistent.replay == True
    
And I have this as my button:

Code: Select all

    if persistent.replay == True:
        imagebutton auto "assets/images/menu/buttons/btn_start_%s.png" action ShowMenu("replay_gallery") xpos 550 ypos 394 focus_mask True 
But the button wont unlock after passing that point no matter what i do. What it going on.
Kyle Tyner
Creator of Unwonted Studios
ktyner@unwontedstudios.co
Visit Our Website
Projects: No One But You, Sickness, Written in the Sky, Wander no more, Catch Canvas, Warped Reality

User avatar
Laiska
Veteran
Posts: 323
Joined: Sat Jan 11, 2014 1:14 am
Completed: Queen At Arms, Cerulean, The Shadows That Run Alongside Our Car, Vicarwissen
Projects: Caramel Mokaccino
Tumblr: minesweeperaddict
Deviantart: koyoba
Contact:

Re: Persistent data Unlocking Button.

#2 Post by Laiska » Sun Apr 26, 2015 2:09 am

I believe you're only supposed to have a single '=' for setting a variable, '==' is only for evaluation.

So: $ persistent.replay = True

I could be wrong. I've had no trouble getting this to work though:
if (persistent.check1 is False):
add "heart" xalign 1.0 yalign 0.0
paired with
$ persistent.check1 = True
wherein the first line makes a heart icon appear in the main menu, only if a persistent variable hasn't been set to true in the script yet.

Onishion
Veteran
Posts: 295
Joined: Mon Apr 20, 2015 10:36 am
Contact:

Re: Persistent data Unlocking Button.

#3 Post by Onishion » Sun Apr 26, 2015 4:10 am

Laiska's correct, at least on the first bit. One easy way to check that sort of thing is that after you do the thing that's meant to activate the button, hit ctrl-d and open the variable viewer, to see if that variable has in fact changed. If we're right on this one, it won't have changed the way you have it there (I know this because I'm constantly messing this up by copy-pasting elements and forgetting to add or remove an "="). ;)

User avatar
KairuKyun
Veteran
Posts: 286
Joined: Thu Feb 12, 2015 4:10 pm
Completed: No One But You, Catch Canvas, Sickness, Written in the Sky, Wander no more, Warped Reality
Projects: Warped Reality
Organization: Unwonted Studios
IRC Nick: Kairu_kyun
Tumblr: karamuchan
Contact:

Re: Persistent data Unlocking Button.

#4 Post by KairuKyun » Sun Apr 26, 2015 12:35 pm

Dang, I didn't even notice that :P
Kyle Tyner
Creator of Unwonted Studios
ktyner@unwontedstudios.co
Visit Our Website
Projects: No One But You, Sickness, Written in the Sky, Wander no more, Catch Canvas, Warped Reality

Post Reply

Who is online

Users browsing this forum: Alex, Google [Bot], nyeowmi