Urgent! Hiding and showing 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
Message
Author
fantasticGummy
Newbie
Posts: 1
Joined: Sat Aug 08, 2015 7:23 pm
Contact:

Urgent! Hiding and showing choices

#1 Post by fantasticGummy »

Hello! I'm a beginner user to ren'py, making a dating sim. I want to release my game today but I just have this one bit to go. I want to do something with choices but I'm not sure how. I want the player to talk to a character about something, and in order to have a new choice shown, the player has to talk to all the other main characters about something first, then go back to that character. I don't understand If and Condition statements very well, so if someone can help explain it to me, I'll be very grateful. Thank you!

User avatar
JhazyJazz
Regular
Posts: 35
Joined: Fri Feb 19, 2016 4:22 am
Completed: Best Friends
Organization: Pastelle Studios
Contact:

Re: Urgent! Hiding and showing choices

#2 Post by JhazyJazz »

Does this help?

Code: Select all

label start:

    e "You've created a new Ren'Py game."

    e "Once you add a story, pictures, and music, you can release it to the world!"
    "Talk to Eileen?"
    menu:
        "Yep.":
            jump yep
        "Nope.":
            jump nope
label yep:
    a"Hello Eileen!"
    e"Hello!"
    return
label nope:
    "You don't want to talk?"
    "Okay.."

    return
hope it helps~
Last edited by JhazyJazz on Fri Feb 19, 2016 6:08 am, edited 1 time in total.
I support:
Image
Completed Games:

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Urgent! Hiding and showing choices

#3 Post by xela »

JhazyJazz wrote:Does this help?
Not likely...

Something along the lines of:

Code: Select all

default flag1 = False
default flag2 = False

label start:
    menu:
        "Talk to NPC1":
            "Hi NPC1"
            $ flag1 = True
            jump start
        "Talk to NPC2":
            "Hi NPC2"
            $ flag2 = True
            jump start
        "Go Bowling!" if flag1 and flag2:
            "The three of you go out to have some fun!"
might help but don't we have like 1000 of these examples...
Like what we're doing? Support us at:
Image

User avatar
JhazyJazz
Regular
Posts: 35
Joined: Fri Feb 19, 2016 4:22 am
Completed: Best Friends
Organization: Pastelle Studios
Contact:

Re: Urgent! Hiding and showing choices

#4 Post by JhazyJazz »

xela wrote:
JhazyJazz wrote:Does this help?
Not likely...

Something along the lines of:

Code: Select all

default flag1 = False
default flag2 = False

label start:
    menu:
        "Talk to NPC1":
            "Hi NPC1"
            $ flag1 = True
            jump start
        "Talk to NPC2":
            "Hi NPC2"
            $ flag2 = True
            jump start
        "Go Bowling!" if flag1 and flag2:
            "The three of you go out to have some fun!"
might help but don't we have like 1000 of these examples...
Duly Noted!~

User avatar
FonaCall
Regular
Posts: 98
Joined: Sun Dec 13, 2015 6:59 am
Projects: Bahay Kubo, Tower of Saviors Cries of Soul
Organization: Black Eared Games
Tumblr: blackearedgames
Deviantart: fonacall
Skype: fona.call
Soundcloud: fona-call
Location: Philippines
Contact:

Re: Urgent! Hiding and showing choices

#5 Post by FonaCall »

Hello.

I think xela give idea of what do already, but maybe change bit of something in code? I change code a bit, then will try explain.

Code: Select all

label start:

    $ talk_npc1 = False
    $ talk_npc2 = False

label talk_menu:

    menu:
        "Talk to NPC1":
            "Hi NPC1"
            $ talk_npc1 = True
            jump talk_menu
        "Talk to NPC2":
            "Hi NPC2"
            $ talk_npc2 = True
            jump talk_menu
        "Go Bowling!" if talk_npc1 and talk_npc2:
            "The three of you go out to have some fun!"
So, is start with these:

Code: Select all

label start:

    $ talk_npc1 = False
    $ talk_npc2 = False
Probably know what start label is, as is where game starts. After that, declare variable, is line with dollar sign. Is like marker for game to check something. Variable help check lots of things, like if action been done or not done, or how many points have already.

In this case, you want game to check if you talk to NPC 1 and 2 already.

Code: Select all

label talk_menu:

    menu:
        "Talk to NPC1":
            "Hi NPC1"
            $ talk_npc1 = True
            jump talk_menu
        "Talk to NPC2":
            "Hi NPC2"
            $ talk_npc2 = True
            jump talk_menu
        "Go Bowling!" if talk_npc1 and talk_npc2:
            "The three of you go out to have some fun!"
I put menu under different label now. I do it to be safe with making variable stay True after make variable True with talk to NPC, since I usually declare variable after start label. No want endless loop with no new choice. No sure what happen if declare variable before start label, though.

So, what code do is show menu first to choose if talk with NPC 1 or NPC 2. When decide to talk to NPC, you get talk to NPC and variable become true, then you jump to label for menu so can choose something else. Go bowling appear when both variable are True.

Is helpful? If still confuse, can also try look at other people game and code if can and try copy some things.
SO MANY GAMES, SO LITTLE TIME!!!

For those who are freelance VN staff and also for those who are VN team leaders, please read this. Inform yourselves. Thank you.

Status: More or less busy with IRL work and finishing a game in time for Halloween Jam in itch.io

Brainstorming for the following:
My Seven Deadly Friends | the rest of the ideas

User avatar
MimirollCookie
Miko-Class Veteran
Posts: 725
Joined: Sat May 23, 2015 5:05 am
Completed: Best Friends (DRAMA), Sweet and Spices (NaNo16)
Projects: Cupid's Wish, Best Friends Deux
Organization: Pastelle Studios
Deviantart: MimirollCookie
Location: A place where rainbows and unicorns collide. ^0^
Contact:

Re: Urgent! Hiding and showing choices

#6 Post by MimirollCookie »

FonaCall wrote:Hello.

I think xela give idea of what do already, but maybe change bit of something in code? I change code a bit, then will try explain.

Code: Select all

label start:

    $ talk_npc1 = False
    $ talk_npc2 = False

label talk_menu:

    menu:
        "Talk to NPC1":
            "Hi NPC1"
            $ talk_npc1 = True
            jump talk_menu
        "Talk to NPC2":
            "Hi NPC2"
            $ talk_npc2 = True
            jump talk_menu
        "Go Bowling!" if talk_npc1 and talk_npc2:
            "The three of you go out to have some fun!"
So, is start with these:

Code: Select all

label start:

    $ talk_npc1 = False
    $ talk_npc2 = False
Probably know what start label is, as is where game starts. After that, declare variable, is line with dollar sign. Is like marker for game to check something. Variable help check lots of things, like if action been done or not done, or how many points have already.

In this case, you want game to check if you talk to NPC 1 and 2 already.

Code: Select all

label talk_menu:

    menu:
        "Talk to NPC1":
            "Hi NPC1"
            $ talk_npc1 = True
            jump talk_menu
        "Talk to NPC2":
            "Hi NPC2"
            $ talk_npc2 = True
            jump talk_menu
        "Go Bowling!" if talk_npc1 and talk_npc2:
            "The three of you go out to have some fun!"
I put menu under different label now. I do it to be safe with making variable stay True after make variable True with talk to NPC, since I usually declare variable after start label. No want endless loop with no new choice. No sure what happen if declare variable before start label, though.

So, what code do is show menu first to choose if talk with NPC 1 or NPC 2. When decide to talk to NPC, you get talk to NPC and variable become true, then you jump to label for menu so can choose something else. Go bowling appear when both variable are True.

Is helpful? If still confuse, can also try look at other people game and code if can and try copy some things.
Hmm.....
Maybe FonaCall's right!
Maybe that'll solve everyone's problem!

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Urgent! Hiding and showing choices

#7 Post by xela »

I've completely lost the "flow" of this thread :D
Like what we're doing? Support us at:
Image

Post Reply

Who is online

Users browsing this forum: voluorem