Inputs and randomize dialog?
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.
Inputs and randomize dialog?
Hey so I started using Renpy and finally sitting down to learn it and while I'm getting a hang of things, I'm trying to do something where the character picks a choice randomly but you input text in itself. I've been staring at the input text screens but I don't fully understand how to do this.
So like Option A is your truth, Option B is your lie and the character has a 50% chance to pick either one of them.
If anyone would know how to code this and explain how it works, I'd really appreciate this. I'm not someone who codes a lot so ;;
So like Option A is your truth, Option B is your lie and the character has a 50% chance to pick either one of them.
If anyone would know how to code this and explain how it works, I'd really appreciate this. I'm not someone who codes a lot so ;;
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3785
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Inputs and randomize dialog?
So basically you're presented the option to 'lie' and 'be truthful' and uopn selection, the player types what to reply?
You can use renpy.input to achieve that, but unless you're also detecting particular phrases / words, what purpose does it serve other than to force a player to type something?
You can use renpy.input to achieve that, but unless you're also detecting particular phrases / words, what purpose does it serve other than to force a player to type something?
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Re: Inputs and randomize dialog?
I honestly don't fully know. I'm just trying to learn all aspects and grow myself, and tbh I don't fully understand renpy.input haha... sorry.Imperf3kt wrote: ↑Mon Sep 17, 2018 1:36 am So basically you're presented the option to 'lie' and 'be truthful' and uopn selection, the player types what to reply?
You can use renpy.input to achieve that, but unless you're also detecting particular phrases / words, what purpose does it serve other than to force a player to type something?
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3785
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Inputs and randomize dialog?
Its an okay idea, I just suggest making more use of the typed reply.
Perhaps have it reappear later in conversation?
If you wait about 2~3 hours, I can post an example of how to do it.
Perhaps have it reappear later in conversation?
If you wait about 2~3 hours, I can post an example of how to do it.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3785
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Inputs and randomize dialog?
Oops, completely forgot about this.
About to go to work, so this is kinda hurried, but this should do the trick.
About to go to work, so this is kinda hurried, but this should do the trick.
Code: Select all
default my_reply = "anything"
label start:
menu:
"Lie":
$ my_reply = renpy.input('What will you say?') or None
"Be truthful":
$ my_reply = renpy.input('What will you say?') or None
"[my reply]"
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Re: Inputs and randomize dialog?
I'm gonna try this! Thank you!Imperf3kt wrote: ↑Mon Sep 17, 2018 4:09 pm Oops, completely forgot about this.
About to go to work, so this is kinda hurried, but this should do the trick.Code: Select all
default my_reply = "anything" label start: menu: "Lie": $ my_reply = renpy.input('What will you say?') or None "Be truthful": $ my_reply = renpy.input('What will you say?') or None "[my reply]"
Re: Inputs and randomize dialog?
It's working and I'm seeing what I wanted to more now that I'm understanding the commands
And where I have my reply, I want the character to pick one of the two replies you input randomly!
Code: Select all
p "Okay then! What about you."
m "What about me?"
p "What's your truth and lie?"
m "Oh... Uh..."
$ my_reply = renpy.input('What is your lie?') or None
$ my_reply = renpy.input('What is your truth?') or None
p "Well. I choose... ["my reply"]"
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3785
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Inputs and randomize dialog?
So just to be sure I understand correctly, you want to allow a player to input a lie and input a truth, then have renpy randomly select one of those replies to use in the dialogue?
That should be easy enough to do and renpy includes a few ways to do the randomising.
I cannot give an example at this time, but if you check out the renpy documentation for renpy.randint or renpy.random, you might be able to work it out from the samples.
You could also present it as a screen, which would afford you more customisability, but that requires a little more work.
I'll try to help more when I have time enough to do so.
That should be easy enough to do and renpy includes a few ways to do the randomising.
I cannot give an example at this time, but if you check out the renpy documentation for renpy.randint or renpy.random, you might be able to work it out from the samples.
You could also present it as a screen, which would afford you more customisability, but that requires a little more work.
I'll try to help more when I have time enough to do so.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Re: Inputs and randomize dialog?
Yeah! I really do appreciate it though whenever you can!Imperf3kt wrote: ↑Mon Sep 17, 2018 7:38 pm So just to be sure I understand correctly, you want to allow a player to input a lie and input a truth, then have renpy randomly select one of those replies to use in the dialogue?
That should be easy enough to do and renpy includes a few ways to do the randomising.
I cannot give an example at this time, but if you check out the renpy documentation for renpy.randint or renpy.random, you might be able to work it out from the samples.
You could also present it as a screen, which would afford you more customisability, but that requires a little more work.
I'll try to help more when I have time enough to do so.
Who is online
Users browsing this forum: No registered users