Choosing players name questions.
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.
-
DeletedUser160413
Choosing players name questions.
Players name: Whenever I choose a name with the letter 'S', the save page comes up. I know its a quick button so I dont want to remove it because players may want to use it, so how do I remove it from when I'm writing the name?
And also there is only a choose name field, but I want to use both first and last names in this game! In work MC is going to be called after her last name, and privately its gonna be her first name, so how do I do this?
And also there is only a choose name field, but I want to use both first and last names in this game! In work MC is going to be called after her last name, and privately its gonna be her first name, so how do I do this?
Re: Choosing players name questions.
Are you typing the name via renpy.input? It shouldn't trigger the save screen at all.
Also for name separation you can try this:
or
Whichever suits you best.
This way you can have [povName] for the full MC name, [povFirstName] for his name and [povLastName] for his surname.
Also for name separation you can try this:
Code: Select all
$ povName = renpy.input("What is your name?", length=50) or "Default full name if none entered"
python:
if " " in povName: #checks there is space char in name, indicating a full name.
povFirstName,povLastName = povName.split(" ")Code: Select all
$ povFirstName = renpy.input("What is your first name?", length=15) or "default name"
$ povLastName = renpy.input("What is your last name?", length=30) or "default surname"
$ povName = povFirstName +" "+povLastNameThis way you can have [povName] for the full MC name, [povFirstName] for his name and [povLastName] for his surname.
-
DeletedUser160413
Re: Choosing players name questions.
Tsapas wrote:Are you typing the name via renpy.input? It shouldn't trigger the save screen at all.
Also for name separation you can try this:This way you can have [povName] for the full MC name, [povFirstName] for his name and [povLastName] for his surname.Code: Select all
$ povName = renpy.input("What is your name?", length=50) or "Default name if none entered" python: if " " in povName:#checks if trigger is persistent or not. povFirstName,povLastName = povName.split(" ")
Omg, perfect. This is what I wanted. But I'm a little confused of where everything should be, sorry :/
Here is what I wrote in the script:
"What's your name?"
# The phrase in the brackets is the text that the game will display to prompt
# the player to enter the name they've chosen.
$ player_name = renpy.input("What is your name?")
$ player_name = player_name.strip()
# The .strip() instruction removes any extra spaces the player
# may have typed by accident.
# If the player can't be bothered to choose a name, then we
# choose a suitable one for them:
if player_name == "":
$ player_name="Me"
# And get a nostalgic sigh from Seasons of Sakura fans!
# Now the other characters in the game can greet the player.
"All right, let us start the game, %(player_name)s!"
######################################
It also says in renpy's wiki that player_name might become too difficult to write out everytime. So where exactly do I change it to something like me or m? And btw what if I made the choose name screen obligatory, as in you must choose a name or you cant really go on with the game?
Re: Choosing players name questions.
You can do thismuniiam wrote: Omg, perfect. This is what I wanted. But I'm a little confused of where everything should be, sorry :/
Here is what I wrote in the script:
Code: Select all
"What's your name?"
# The phrase in the brackets is the text that the game will display to prompt
# the player to enter the name they've chosen.
$ player_name = renpy.input("What is your name?") or "Me" #check for no input in name is done here
$ player_name = player_name.strip() # it may interfere with the splitting code if it strips space chars mid-string, need to check on that. If it's a problem use .rstrip() instead.
python:
if " " in player_name:
player_first_name,player_last_name = player_name.split(" ") # If no full name is provided (no space chars), the [player_first_name] and [player_last_name] will remain blank.
# And get a nostalgic sigh from Seasons of Sakura fans!
# Now the other characters in the game can greet the player.
"All right, let us start the game, [player_name]!"
Code: Select all
define player_first_name = ""
define player_last_name = ""
define player_name = "" Well, if it gets to a default name if the player doesn't type in one, I don't see why you should make it obligatoryIt also says in renpy's wiki that player_name might become too difficult to write out everytime. So where exactly do I change it to something like me or m? And btw what if I made the choose name screen obligatory, as in you must choose a name or you cant really go on with the game?
-
DeletedUser160413
Re: Choosing players name questions.
LOL I can't come up with a default name xDTsapas wrote:You can do thismuniiam wrote: Omg, perfect. This is what I wanted. But I'm a little confused of where everything should be, sorry :/
Here is what I wrote in the script:
You also need to define those at start, so it won't produce an errorCode: Select all
"What's your name?" # The phrase in the brackets is the text that the game will display to prompt # the player to enter the name they've chosen. $ player_name = renpy.input("What is your name?") or "Me" #check for no input in name is done here $ player_name = player_name.strip() # it may interfere with the splitting code if it strips space chars mid-string, need to check on that. If it's a problem use .rstrip() instead. python: if " " in player_name: player_first_name,player_last_name = player_name.split(" ") # If no full name is provided (no space chars), the [player_first_name] and [player_last_name] will remain blank. # And get a nostalgic sigh from Seasons of Sakura fans! # Now the other characters in the game can greet the player. "All right, let us start the game, [player_name]!"I've also updated my previous post, to correct some wrongly pasted comments and also show another way.Code: Select all
define player_first_name = "" define player_last_name = "" define player_name = ""
Well, if it gets to a default name if the player doesn't type in one, I don't see why you should make it obligatoryIt also says in renpy's wiki that player_name might become too difficult to write out everytime. So where exactly do I change it to something like me or m? And btw what if I made the choose name screen obligatory, as in you must choose a name or you cant really go on with the game?, just let the player decide.
- 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: Choosing players name questions.
Hiro Protagonist.muniiam wrote:LOL I can't come up with a default name xD
(Although, that name was used for the main character of Snow Crash.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom
-
Deadpool209977
- Newbie
- Posts: 7
- Joined: Sun Dec 26, 2021 3:29 pm
- Completed: Experimental Life Intro
- Projects: Experimental Life: Training
- Organization: BenCo Studios
- Contact:
Re: Choosing players name questions.
I don't get how to set the character to have a default name and still have the rename options.
I posted a script shot to show what I did. Any help for this noob would be appreciated.
Oh! All the "name" slots are confusing.
$ povFirstName = renpy.input("What is your first name?", length=15) or "default name"
or is it supposed to be
$ povFirstName = renpy.input("What is your first name?", length=15) or "Bill"
Where default name is Bill as the main character in the story.
Also how do you sent up the "declare character" for this? I'm so lost LOL!
My Script
# Declare characters used by this game.
define = Character("Bill Johnson")
define v = Character("Vicky")
define s = Character(Sarah")
define j = Character("John")
# Define Images.
# The game starts here.
label start:
$ povFirstName = renpy.input("What is your first name?", length=15) or "default name"
$ povLastName = renpy.input("What is your last name?", length=30) or "default surname"
$ povName = povFirstName +" "+povLastName
NM got it. Just didn't understand to start with.
I posted a script shot to show what I did. Any help for this noob would be appreciated.
Oh! All the "name" slots are confusing.
$ povFirstName = renpy.input("What is your first name?", length=15) or "default name"
or is it supposed to be
$ povFirstName = renpy.input("What is your first name?", length=15) or "Bill"
Where default name is Bill as the main character in the story.
Also how do you sent up the "declare character" for this? I'm so lost LOL!
My Script
# Declare characters used by this game.
define = Character("Bill Johnson")
define v = Character("Vicky")
define s = Character(Sarah")
define j = Character("John")
# Define Images.
# The game starts here.
label start:
$ povFirstName = renpy.input("What is your first name?", length=15) or "default name"
$ povLastName = renpy.input("What is your last name?", length=30) or "default surname"
$ povName = povFirstName +" "+povLastName
NM got it. Just didn't understand to start with.
Who is online
Users browsing this forum: Bing [Bot], _ticlock_