[SOLVED] I can't seem to make a choice loop where already chosen choices disappear

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
LoaExMachina
Newbie
Posts: 9
Joined: Fri Mar 04, 2022 2:54 pm
Github: LoaExMachina
itch: loaexmachina
Contact:

[SOLVED] I can't seem to make a choice loop where already chosen choices disappear

#1 Post by LoaExMachina »

Hello !
I've started working on my first visual novel, and I'm hitting my first issue :
I used a menu where a character has several options, and only one of these options is meant to let him advance in the story; and he gets back to the choice after some dialogue if he's chosen something else.
So far so good, I've already made it work :
Image

But this got a bit trickier when I decided that the player shouldn't be able to select the same choice twice. I tried to follow this advice, but to no avail : I always have this error when I try to launch the game with these changes :
Image


Here is my code, what am I doing wrong ?

Code: Select all



define u = Character(_("Great Cube of Ousia"),color="#BE150E" )
define a = Character(_("Anon"),color="#22628F" )
default chosen = set()
.

label start:



    scene room


    "Hmm, morning already. Seems like I have to get up soon. But how soon ?
    maybe I still have time to sleep a little."
    "I stand up and look for my phone, when..."
    show cube1
    u "Hi !"
    a "AAAAAAAAAHHHHH"
    "A big red levitating Cube materializes itself before me"
    u "Wowowow, calm down ! Are you okay ?"
    a"What the fuck, what the f*ck, what the..."
    u "Ok, I get it, I startled you... I'll just wait over there for you to collect your thoughts, ok ?"
    hide cube1
    "And the cube disappears. I just seat there, half convinced that this was a dream.
    My alarm rings. It doesn't seem like I'm waking up... Or maybe I had already woken up before realizing ? Any way, I gotta get up now."
    "I stand up and open the door and..."

    scene kitchen
    show cube2

    u "Oh, hey, did you calm down ?"
    "I feel dizzy, but this time I don't scream."
    u " Hello, I'm the Great Cube of Ousia, nice to meet you !
    I'm guessing this is your first time meeting a transcendent, entity, you certainly have many questions, don't you ?"
  


menu choiceLoop1 :
    set chosen
    u "What would you like to know ?"

        
    "What is a transcendent entity ?":
        jump transcendent
    "What are you doing in my apartment ?":
        jump apology
    "How can I help you ?":
        jump quest

label transcendent:
      a "You referred to yourself as a transcendent entity, right ? What exactly does it mean ?"
      u "Oh, It's a word I came up with myself to convey how I perceive many more dimensions than your kind
         and constantly travel through a dimension perpendicular to your time."
      jump choiceLoop1
      chosen.add("What is a transcendent entity ?")
      jump choiceLoop1
label apology:
   a "What are you doing in my apartment ?"
   u "Oh, sorry, I guess it was rude of me to intrude... But I'd rather not be seen by to many other people, so I had to meet you here.
        I really need your help, and I can help you in return !"
   jump choiceLoop1

label quest:
        u "So basically, in the far future, after humanity goes extinct, some chicken evolve convergently with both mesosoic theropods and humans.
        They form a brilliant civilization, and they're beautiful. One of them in particular. Pukkipokov. I'm in love with her."
        u "But at the time when she lives, her species have found out about the possibility of extradimentional threats and have erected barriers that
        keep me from interacting with her."
        u "But you see, Pukkipokov is a paleontologist, and she's gonna be digging not far from where you live.
        If I were to engrave instructions addressed to her on how to summon me through the barrier and you were to bury it in the spot I tell you, she'd definitely find it !"
        jump end        


label end:
        return


   
Thank you for your help !
Last edited by LoaExMachina on Thu Jan 19, 2023 9:38 am, edited 1 time in total.

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: I can't seem to make a choice loop where already chosen choices disappear

#2 Post by _ticlock_ »

LoaExMachina wrote: Wed Jan 18, 2023 6:01 pm

Code: Select all


      chosen.add("What is a transcendent entity ?")
Python code must be inside python block or use $ for one-line Python Statement

Code: Select all


      $ chosen.add("What is a transcendent entity ?")

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2428
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: I can't seem to make a choice loop where already chosen choices disappear

#3 Post by Ocelot »

You do not need to add antything to the set manually, menu statement already does it automatically.
< < insert Rick Cook quote here > >

LoaExMachina
Newbie
Posts: 9
Joined: Fri Mar 04, 2022 2:54 pm
Github: LoaExMachina
itch: loaexmachina
Contact:

Re: I can't seem to make a choice loop where already chosen choices disappear

#4 Post by LoaExMachina »

Wow, this was fast ! Thank you _ticlock_ and Ocelot ! I tried both your solutions and they both work, my problem is solved ! Thank you again, and have a great day !

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]