Reactions to Player Name Input

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
ryinth
Newbie
Posts: 3
Joined: Wed Oct 09, 2019 7:53 am
Contact:

Reactions to Player Name Input

#1 Post by ryinth »

So we're very new to Renpy, and this is the first semi-complicated bit of code we've tried. I think we've done the equivalent of 1+1=3 with these options, so...help?

Basically, we want to drop in some easter eggs for the story the game is based on (reactions are placeholders, of course). So, if a player enters "Character X", they get a line of dialogue referencing that character.

(Also, can we do something like? (Showing the sprite would be great to add extra flavour).

Code: Select all

show sprite confused
v  "This can't be good."

Current Code

Code: Select all

#This is where you put the codes.
    $ name1 = "Stef"
    $ name2 = "Vincent"
    $ name3 = "Magnolia"

    name = renpy.input(_("Vincent lost the paperwork, what was your name again?"))
    $ name = player_name.strip()

#  If the player can't be bothered to choose a name, then we
#  choose a suitable one for them:
    if player_name == "":
        $ player_name="Bob"

if input == name1:
    "This can't be good."
elif input == name2:
    "Of course it is."
elif input == name3:
    "I had a dream like that once."

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Reactions to Player Name Input

#2 Post by isobellesophia »

ryinth wrote: Fri Oct 25, 2019 2:17 am So we're very new to Renpy, and this is the first semi-complicated bit of code we've tried. I think we've done the equivalent of 1+1=3 with these options, so...help?

Basically, we want to drop in some easter eggs for the story the game is based on (reactions are placeholders, of course). So, if a player enters "Character X", they get a line of dialogue referencing that character.

(Also, can we do something like? (Showing the sprite would be great to add extra flavour).

Code: Select all

show sprite confused
v  "This can't be good."

Current Code

Code: Select all

#This is where you put the codes.
    $ name1 = "Stef"
    $ name2 = "Vincent"
    $ name3 = "Magnolia"

    name = renpy.input(_("Vincent lost the paperwork, what was your name again?"))
    $ name = player_name.strip()

#  If the player can't be bothered to choose a name, then we
#  choose a suitable one for them:
    if player_name == "":
        $ player_name="Bob"

if input == name1:
    "This can't be good."
elif input == name2:
    "Of course it is."
elif input == name3:
    "I had a dream like that once."
Something like this?

Code: Select all

label naming:
    python:
        name = renpy.input(_("Anything! But real names i really wanted."))

        name = name.strip() or __("Student")

#######################################################

    if name in ['Facter','Facter']:
        show m shocked with dissolve
        m "True name. You can enter!!"
        jump game

    if name in ['Loli','loli']:
        show m think with dissolve
        m "My friend had this name, im so sorry, try again!"
        jump naming
I am a friendly user, please respect and have a good day.


Image

Image


ryinth
Newbie
Posts: 3
Joined: Wed Oct 09, 2019 7:53 am
Contact:

Re: Reactions to Player Name Input

#3 Post by ryinth »

Perfect, thank you so much!

Post Reply

Who is online

Users browsing this forum: Classy_Lemon