Page 1 of 1

customized responses based on player input

Posted: Sun Feb 24, 2019 12:56 pm
by lunakohl
At the beginning of my game as a joke I prompt the player to input their name but then later issue them a predetermined name, sort of like Toby Fox's Deltarune.
I'm a complete coding amateur so I'm not sure if there's a way to do this in this program, but I was wondering if there was any way to customize my game's response to what the player types in.

For example, if they typed in the name of a pre-existing character, is there a way I could show only certain scenes, or end the game immediately?
Or at least not allow them to input the name I will assign them?

Here is the code I'm using for reference:

Code: Select all

define pov = Character("[povname]")

    python:
        povname = renpy.input("So. What is your name?")
        povname = povname.strip()

    "Nice to meet you, [povname]."

Re: customized responses based on player input

Posted: Mon Feb 25, 2019 12:12 am
by isobellesophia

Code: Select all

define pov = Character("[povname]") 
python: 
povname = renpy.input("So. What is your name?") 
povname = povname.strip(allow=None) 
"Nice to meet you, [povname]."

Code: Select all

define pov = Character("[povname]") 
python: 
povname = renpy.input("So. What is your name?") 
povname = povname.strip() 
"Nice to meet you, [povname]." 
$ renpy.quit()
Sorry for the line indention, i am currently using a tablet.

Re: customized responses based on player input

Posted: Tue Feb 26, 2019 2:24 pm
by xavimat
povname is a variable. You can use "if/elif/else" to check anything with it.
(don't need the "python" part, put them inside a label with $ at the begining of the lines)

Code: Select all

define pov = Character("[povname]")
label set_povname:
    $ povname = renpy.input("So. What is your name?").strip()
    if povname == "Eileen":
        "Eileen" "That can't be possible, I AM Eileen, not you."
        jump set_povname
    elif povname == "Lucy":
        "Eileen" "Oh, no, I know Lucy, and you are not her."
        jump set_povname
    "Nice to meet you, [povname]."

Re: customized responses based on player input

Posted: Tue Feb 26, 2019 3:52 pm
by lunakohl
Thank you guys so much!