Menu Question

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
Tryth
Newbie
Posts: 2
Joined: Sun Sep 07, 2014 11:39 pm
Projects: Flicker: A Murder Mystery in Space
Contact:

Menu Question

#1 Post by Tryth »

Hey everyone!

I'm new to the forum, but I've been working on a Ren'Py game for a few months now. So far I've been able to find everything I need in the wiki, but I've run into a problem that is probably very easy to solve. For a current section of the game I'm working on, I want to make it so a player is only allowed to pick two options from a menu of four choice. When the player clicks on the third choice, I would like the game to immediately jump to a new section of story without allowing the player to pick the third and fourth choice.

In action it would work like this:

The player is brought to a menu with four options. The player picks the first option. After reading through the first option, the player is brought back to the choice screen and now sees that there are three options for him to pick, the first one now missing. The player picks the second option. After reading through the second option, the player is brought back to the choice screen and now sees there are only two options left. The player picks the third option. However, instead of playing what the third option would be, the game jumps to a new event that now pushes the player forward, thus not allowing him to see the third and fourth choices.

I know this is doable, but my noobish skills with this software really show when I try. Can someone help me out? :)

Thanks!

User avatar
Onomatopoeia
Regular
Posts: 40
Joined: Wed Jan 11, 2012 7:36 pm
Location: GA
Contact:

Re: Menu Question

#2 Post by Onomatopoeia »

1 - Welcome to the forum!

2 - I adore your avatar, even though I'm a total Zoe.

3 - Here is the code in which I would personally use, but I'm sure someone out there has something more elegant for you:

Don't forget to set up your variables!

Code: Select all

    $ choice_A = 'false'
    $ choice_B = 'false'
    $ choice_C = 'false'
    $ choice_D = 'false'
    $ counter_thingie = 0
Then throw in this code:

Code: Select all

label Yay_Choices:
    
    menu:
        "Choice 1" if choice_A == 'false':
            $ counter_thingie += 1
            $ choice_A = 'true'
            if counter_thingie == 3:
                "You decide you hate making decisions."
                jump Boo_No_Choices
            else:
                "You love making decisions so much, you'll do it again!"
                jump Yay_Choices
                
        "Choice 2" if choice_B == 'false':
            $ counter_thingie += 1
            $ choice_B = 'true'
            if counter_thingie == 3:
                "The smell of cinnamon buns distracts you to elsewhere."
                jump Boo_No_Choices
            else:
                "You are diabetic, so stay with this menu."
                jump Yay_Choices
                
        "Choice 3" if choice_C == 'false':
            $ counter_thingie += 1
            $ choice_C = 'true'
            if counter_thingie == 3:
                "You jump out of the window."
                jump Boo_No_Choices
            else:
                "You Pac-Man back to the choice menu."
                jump Yay_Choices
                
        "Choice 4" if choice_D == 'false':
            $ counter_thingie += 1
            $ choice_D = 'true'
            if counter_thingie == 3:
                "This room is too cold, you go somewhere warmer."
                jump Boo_No_Choices
            else:
                "You enjoy the temperature of the Choice-Making room."
                jump Yay_Choices
As I said, I'm sure there is a more elegant option available, but this should get what you need done until it illuminates itself.

User avatar
Tryth
Newbie
Posts: 2
Joined: Sun Sep 07, 2014 11:39 pm
Projects: Flicker: A Murder Mystery in Space
Contact:

Re: Menu Question

#3 Post by Tryth »

Onomatopoeia wrote:1 - Welcome to the forum!
Thank you!
2 - I adore your avatar, even though I'm a total Zoe.
That's a total Zoe thing to say!
3 - Here is the code in which I would personally use, but I'm sure someone out there has something more elegant for you:
EDIT: Never mind, it works! The variables just weren't working where I had placed them. Thank you so much!

User avatar
Onomatopoeia
Regular
Posts: 40
Joined: Wed Jan 11, 2012 7:36 pm
Location: GA
Contact:

Re: Menu Question

#4 Post by Onomatopoeia »

Tryth wrote:EDIT: Never mind, it works! The variables just weren't working where I had placed them. Thank you so much!
Well I didn't see this pre-edit, but either way I'm glad it works now!

Good luck with your project, can't wait to see it.

User avatar
Alera
Miko-Class Veteran
Posts: 651
Joined: Sun Mar 21, 2010 3:20 am
Completed: Tortichki // Zayay // Hero's Spirit
Deviantart: psyalera
itch: psyalera
Location: UK
Contact:

Re: Menu Question

#5 Post by Alera »

@Onomatopoeia

Just out of curiosity, why are you using strings to declare your true/false states instead of just typing it as a boolean? What I mean is:

Code: Select all

$ choice_A = False 
# Instead of 
$ choice_A = 'false'
I don't think your method is particularly wrong, just quite uncommon?
Image
Games:
❤️ Zayay [Otome?][BxPlayer][NaNo 2013]
❤️ Tortichki [Drag&Drop mini game]

Other games I've worked on:
My Heart's Flame Emissary of Starlight Freedom From Silence Sickness
And many more unannounced/secret projects. (. .)

User avatar
Onomatopoeia
Regular
Posts: 40
Joined: Wed Jan 11, 2012 7:36 pm
Location: GA
Contact:

Re: Menu Question

#6 Post by Onomatopoeia »

Alera wrote:Just out of curiosity, why are you using strings to declare your true/false states instead of just typing it as a boolean?
Well, that's mainly because I wrote it at 1am!

That is actually a serious answer. I got off of work and was tired. I originally wrote it with some random nonsense instead of the true/false, but decided to change it at the last minute so it'd be easier to read. I just simply didn't go through with the changes fully.

I totally forgot all about it, but I thank you for bringing that to my attention, Alera!

Post Reply

Who is online

Users browsing this forum: No registered users