Need more help, please! (Choice recognition)

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
realaniram
Regular
Posts: 33
Joined: Sun Sep 18, 2011 1:36 pm
Projects: Shaeyu jun Ikkshaelun
Contact:

Need more help, please! (Choice recognition)

#1 Post by realaniram »

How do I get the program to test against a menu choice? As in, my player has an option to choose to lie or to tell the truth. The person they are lying to/being honest to will know what they're doing, and will either admonish them or praise them based on their choice.

I've tried attaching variables to the choices, but that's not working either. I guess I don't know how to ask an 'if' statement for a variable, either. Do I need to name the variables when I declare them under the choice? And how?

Thanks in advance!
Shaeyu jun Ikkshaelun-- A work in progress.

Forever Newb

Rewritten Ennui
Veteran
Posts: 279
Joined: Thu Jul 14, 2011 1:50 pm
Organization: TwinTurtle Games
Contact:

Re: Need more help, please! (Choice recognition)

#2 Post by Rewritten Ennui »

...? :| Just do a simple menu, like so:

Code: Select all

menu:
    "What do two and two make?"
    "Four.":
        "You told the truth..."
        "Congrats! You can do math."
    "Five.":
        "You lied..."
        "Liar! Next you'll be saying that black is white, white is black, and all that nonsense!"
Menus are pretty basic, unless you're trying to do something else...
I've swapped accounts to CheeryMoya, so this account is no longer in use. Refer to the new account if you want to contact me.

Twinturtle Games Website

realaniram
Regular
Posts: 33
Joined: Sun Sep 18, 2011 1:36 pm
Projects: Shaeyu jun Ikkshaelun
Contact:

Re: Need more help, please! (Choice recognition)

#3 Post by realaniram »

@ Rewritten Ennui :

I know how to do a menu, lol. I'm just trying to do a background choice recognition. Basically, the character is asked how they got to where they are, and have the choice to either distrust the person they just met and lie (Pft, I totally know where I'm going.) then lie again (I told you I don't need help!) or 'fess up to the truth (Ah... Sorry, I lied. I really don't know.) or admit they don't know anything first (I, um, need some help?). After a bit of dialogue, the NPC will say something like, "You know, I don't like how you lied to me. But I'm going to help you out anyway," if the lying option was chosen the whole time (the NPC can tell). Or "You're a bit too trusting, but luckily for you I'm around and I'm not that kind of person," if the truth option was chosen first. If you lie, then tell the truth, it would probably be something like "Ha! I knew you were lying. <Insert help here>".

If this kind of shortcut isn't possible, then I suppose I'll just have to make it all long and drawn out. @_@
Shaeyu jun Ikkshaelun-- A work in progress.

Forever Newb

Rewritten Ennui
Veteran
Posts: 279
Joined: Thu Jul 14, 2011 1:50 pm
Organization: TwinTurtle Games
Contact:

Re: Need more help, please! (Choice recognition)

#4 Post by Rewritten Ennui »

I guess you can make a trust variable and increase or decrease it accordingly. Whenever you tell the truth, increase the variable. Whenever you lie, decrease the variable. Use the 'if' statement to control when the variable determines whether or not you see an event or whatever. It's kinda common sense...
I've swapped accounts to CheeryMoya, so this account is no longer in use. Refer to the new account if you want to contact me.

Twinturtle Games Website

Anarchy
Veteran
Posts: 331
Joined: Mon Sep 12, 2011 1:51 am
Projects: Fairy Tales of Innocent Children
Contact:

Re: Need more help, please! (Choice recognition)

#5 Post by Anarchy »

Variables wouldn't work in this situation though, because the order in which the lies happen is also important.

It looks like you'll have to take the long and circuitous road, at least from the perspective of a programming newb like me...

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

#6 Post by Aleema »

I'm with Rewritten Ennui on this. Just make a variable counter:

Code: Select all

label lying:
    $ num_lied = 0
    
    menu:
        "I, um, need some help?":
            pass
        "No":
            $ num_lied += 1 #they lied
            "You sure?"
            menu:
                "Ah... Sorry, I lied. I really don't know.":
                    pass
                "I told you I don't need help!":
                    $ num_lied += 1 #they lied

    if num_lied == 1:
        "Okay I'll help"
    elif num_lied > 1:
        "You know, I don't like how you lied to me. But I'm going to help you out anyway"
    else: #0
        "You're a bit too trusting, but luckily for you I'm around and I'm not that kind of person."

KimiYoriBaka
Miko-Class Veteran
Posts: 636
Joined: Thu May 14, 2009 8:15 pm
Projects: Castle of Arhannia
Contact:

Re: Need more help, please! (Choice recognition)

#7 Post by KimiYoriBaka »

actually, in this case I don't think the problem itself is complex enough for a variable to be needed. why not just use the nested menu in aleema's code, then put a jump at the end of each option to a separate label, then jump back after the response?

now, if the npc is going to remember this later, that would need a variable, but that's something else entirely.

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: Need more help, please! (Choice recognition)

#8 Post by Aleema »

You probably don't even need to jump at all, just put the various degrees of responses directly under the menu choices. Not really sure how complex a problem this is, either. But he did say he knew how to use menus ... even though we're back to where we started in the thread.

realaniram
Regular
Posts: 33
Joined: Sun Sep 18, 2011 1:36 pm
Projects: Shaeyu jun Ikkshaelun
Contact:

Re: Need more help, please! (Choice recognition)

#9 Post by realaniram »

Hm. I actually hadn't thought of a lying 'meter' like that. I think that could work out well, I could just add the number of times they'd lied and every time the character interacts with a NPC that's aware of the lies I could check against the variable for the proper reactions.

Thanks, everyone!

If I have anymore trouble I suppose I'll just have to throw myself to the wolves again. :/
Shaeyu jun Ikkshaelun-- A work in progress.

Forever Newb

Post Reply

Who is online

Users browsing this forum: No registered users