Change player's name with a fixed first letter

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
User avatar
Lockvia
Regular
Posts: 124
Joined: Wed Mar 26, 2014 8:02 pm
Projects: Prank Masters
Organization: Lockvia Studios
Tumblr: Lockvia
Deviantart: Lockvia
Location: Australia
Contact:

Change player's name with a fixed first letter

#1 Post by Lockvia » Thu Jan 15, 2015 4:21 am

I have been thinking of using a story plot where the protagonist first letter in their name is the same as the rest of their family. Which made me wonder if it's possible to have an option of having a custom player's name but with a condition that the first letter needs to start with a specific letter like the letter 'M'.
Image

User avatar
78909087
Veteran
Posts: 277
Joined: Sat Aug 16, 2014 2:33 pm
Completed: Dungeons and Don't Do It, Wake Up
Projects: Lethe
IRC Nick: Pacermist
Contact:

Re: Change player's name with a fixed first letter

#2 Post by 78909087 » Thu Jan 15, 2015 5:01 am

To be honest, I became rather annoyed quickly with allowing people to choose their names. Now I set it as a menu, with prespecified names that people can choose. Here's a script example.

Under characters:

Code: Select all

define me = DynamicCharacter("povname", color=(192, 64, 64, 255))
In the script, where the person should choose their name:

Code: Select all

menu:

        nvlq "Your name..."
        "Alex.":

            $ povname = "Alex"
            nvl clear

        "Aaron.":

            $ povname = "Aaron"
            nvl clear

        "Jack.":

            $ povname = "Jack"
            nvl clear

        "Ben.":

            $ povname = "Ben"
            nvl clear

        "Iden.":

            $ povname = "Iden"
            nvl clear
Don't mind the nvl clear- I was using a menu in NVL mode, but this would work in normal mode too.


You can use this idea with names that start with 'M' and it shouldn't make much of a difference.

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Change player's name with a fixed first letter

#3 Post by PyTom » Thu Jan 15, 2015 11:58 am

Slightly more complex, you could redefine the input screen to be:

Code: Select all

screen input(prompt):

    window style "input_window":
        has vbox

        text prompt style "input_prompt"
        hbox:
            text "M"
            input id "input" style "input_text"

    use quick_menu
and then use:

Code: Select all

$ povname = "M" + renpy.input("I know my name begins with M, but what is it?").strip()
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
xavimat
Eileen-Class Veteran
Posts: 1458
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Contact:

Re: Change player's name with a fixed first letter

#4 Post by xavimat » Fri Jan 16, 2015 4:35 pm

You can try:

Code: Select all

label start:
    $ povname = ""
    while not povname.startswith("M"):
        $ povname = renpy.input("My name is...", default="M").strip()
        if not povname.startswith("M"):
            "Mmmmmm. I don't think so. My name starts with 'M'."
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Post Reply

Who is online

Users browsing this forum: Bing [Bot]