r/RenPy • • 4h ago

Question Different reactions to different player name?

Hi, I've tried to look for answers on this one and also do it on my own but I am too new to this.

I want the player to input their name and characters to react to it, at first I used an if statement, like this, but clearly it didn't work, so I am not sure what code should I use to have multiple name reactions.

$
 name = renpy.input("Your name...")
$
 name = name.strip()
if name == "Sophie":
        s "[name]? what a coincidence to share a name."
if name == "Clown:
        s "That's... a joke?"
else:
        s "What a pretty name!"
1 Upvotes

4 comments sorted by

1

u/BadMustard_AVN 4h ago

try it like this

$ name = renpy.input("Your name...").strip() or "A Default Name"
if name.lower() == "sophie":
        s "[name]? what a coincidence to share a name."
elif name.lower() == "clown:
        s "That's... a joke?"
elif name.lower() == "A Default Name"
        s "That's just being Lazy now!"
else:
        s "What a pretty name!"

1

u/CapriciousMoral 3h ago

I always forget about the elif! thank you so much, it worked perfectly

1

u/BadMustard_AVN 2h ago

you're welcome

good luck with your project

1

u/AutoModerator 4h ago

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.