Need more help, please! (Choice recognition)
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.
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.
-
- Regular
- Posts: 33
- Joined: Sun Sep 18, 2011 1:36 pm
- Projects: Shaeyu jun Ikkshaelun
- Contact:
Need more help, please! (Choice recognition)
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!
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!
-
- Veteran
- Posts: 279
- Joined: Thu Jul 14, 2011 1:50 pm
- Organization: TwinTurtle Games
- Contact:
Re: Need more help, please! (Choice recognition)
...? Just do a simple menu, like so:
Menus are pretty basic, unless you're trying to do something else...
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!"
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
Twinturtle Games Website
-
- Regular
- Posts: 33
- Joined: Sun Sep 18, 2011 1:36 pm
- Projects: Shaeyu jun Ikkshaelun
- Contact:
Re: Need more help, please! (Choice recognition)
@ 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. @_@
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. @_@
-
- Veteran
- Posts: 279
- Joined: Thu Jul 14, 2011 1:50 pm
- Organization: TwinTurtle Games
- Contact:
Re: Need more help, please! (Choice recognition)
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
Twinturtle Games Website
-
- 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)
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...
It looks like you'll have to take the long and circuitous road, at least from the perspective of a programming newb like me...
- Aleema
- Lemma-Class Veteran
- Posts: 2677
- Joined: Fri May 23, 2008 2:11 pm
- Organization: happyB
- Tumblr: happybackwards
- Contact:
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."
-
- 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)
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.
now, if the npc is going to remember this later, that would need a variable, but that's something else entirely.
- 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)
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.
-
- Regular
- Posts: 33
- Joined: Sun Sep 18, 2011 1:36 pm
- Projects: Shaeyu jun Ikkshaelun
- Contact:
Re: Need more help, please! (Choice recognition)
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. :/
Thanks, everyone!
If I have anymore trouble I suppose I'll just have to throw myself to the wolves again. :/
Who is online
Users browsing this forum: No registered users