Remembering user choices

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
User avatar
Posts: 69
Joined: Tue May 07, 2013 1:05 pm
Projects: Truculence, Noraska:The cats valley
Organization: Sunset Productions
Location: Cyprus

Remembering user choices

#1 Post by NoahSindri » Sat Nov 29, 2014 12:03 pm

Hello everyone :)
I have a problem in remembering user choices, there are two characters which cannot be remembered at all, for example

Code: Select all

    menu :
        "Go and talk to them" if meet == "Adrian":
            $ Radomir_points -= 1
            $ Alan_points += 1
            $ Adrian_points += 1
            "I really want to hang out with them a little bit...Radomir can wait!"
        "Help Radomir":
            $ Radomir_points += 1
            R"Radomir needs my help"
            R"I can't dissapoint him"
But even though I met Adrian in an earlier choice, the (go and talk to them) menu does not appear at all, it does not appear in any case.
The earlier menu which you can meet Adrian in:

Code: Select all

   "It is none of your business!":
        $ meet = "Radomir"
        $ Adrian_points -= 1
        n"Don't you have any manners?"
   "I am Relic, I just came here and I do not know anything, I wish you could help me":
        $ meet = "Adrian"  
        $ Adrian_points += 1
        s"Oh so you are not a spy?"

As the screenshot down there shows, only one menu appear even though I chose to meet Adrian

Any one could help, please?

User avatar
Lemma-Class Veteran
Posts: 2427
Joined: Fri Dec 11, 2009 5:25 pm

Re: Remembering user choices

#2 Post by Alex » Sat Nov 29, 2014 4:41 pm

Are you sure the "meet" variable's value wasn't changed between those menus?
Don't you called in new context one of your menus? Don't you restore game from save made before some code was changed?
If won't helped, could you post the part of an actual code that includes both menus or maybe attach the script file to let people test it.

User avatar
Bishie Fangirl
Posts: 814
Joined: Sat Jan 01, 2011 11:24 pm
Completed: Idol Crush
Projects: Shugojin!, RockRobin (openmodewriter), your highness
Soundcloud: jenna-yeon
Location: Orange County, CA

Re: Remembering user choices

#3 Post by Snowflower » Sat Nov 29, 2014 6:15 pm

Well, I just checked my own script since I have used the whole remembering user choice stuff as well with the if statements.
I didn't see anything wrong though...

you'd have better chance posting the entire segment of the code in chronological sequence so that if there's anything wrong with the script as a whole in scene.
Completed: Idol Crush | WIP: your highness | Hiatus: Shugojin!| Follow Me on Twitter | Subscribe to YouTube
your highness @ 102k as of 2/13

User avatar
Posts: 19
Joined: Wed Jul 30, 2014 10:15 am

Re: Remembering user choices

#4 Post by bimb2212 » Sun Nov 30, 2014 9:06 am

As you can check your code in-game use:
for example:

Code: Select all

"Help Radomir: [meet] ":
and result
Help Radomir: Adrian/Radomir (or something that make your "$ meet "go wrong)

I tested your code, and "Go and talk to them" appear.

User avatar
Eileen-Class Veteran
Posts: 1442
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: xavimat
Location: Italy

Re: Remembering user choices

#5 Post by xavimat » Sun Nov 30, 2014 12:51 pm

I use a lot the bimb2212 solution in this way:

Code: Select all

if config.developer:
    "Variable meet: [meet]"
In the end I delete all this checkpoints, but there will be no problem with the final release if some of this code remains there, because the "config.developer" will be False then.

Another way to check variables in-game is the console. Press Shift+O (the letter) and you'll have the console. Type then the name of the variable and you'll have its value. You can also type in the console: "watch meet" and you'll see all the time the variable and the value on the upper right corner of the screen.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Cops&Robbers A two-player experiment
Fear&Love Why can’t we simply express our feelings? Why am I afraid to say ‘I love you’?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Post Reply

Who is online

Users browsing this forum: Mokus