Page 1 of 1

Choosing players name questions.

Posted: Fri Nov 08, 2013 11:02 am
by DeletedUser160413
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?

Re: Choosing players name questions.

Posted: Fri Nov 08, 2013 11:22 am
by Tsapas
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:

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(" ")
or

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 +" "+povLastName
Whichever suits you best.
This way you can have [povName] for the full MC name, [povFirstName] for his name and [povLastName] for his surname.

Re: Choosing players name questions.

Posted: Fri Nov 08, 2013 11:29 am
by DeletedUser160413
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:

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(" ")
This way you can have [povName] for the full MC name, [povFirstName] for his name and [povLastName] for his surname.

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.

Posted: Fri Nov 08, 2013 11:37 am
by Tsapas
muniiam 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 can do this

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]!"
You also need to define those at start, so it won't produce an error

Code: Select all

define player_first_name = ""
define player_last_name = ""
define player_name = ""   
I've also updated my previous post, to correct some wrongly pasted comments and also show another way.
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?
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 obligatory ;), just let the player decide.

Re: Choosing players name questions.

Posted: Fri Nov 08, 2013 12:55 pm
by DeletedUser160413
Tsapas wrote:
muniiam 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 can do this

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]!"
You also need to define those at start, so it won't produce an error

Code: Select all

define player_first_name = ""
define player_last_name = ""
define player_name = ""   
I've also updated my previous post, to correct some wrongly pasted comments and also show another way.
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?
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 obligatory ;), just let the player decide.
LOL I can't come up with a default name xD

Re: Choosing players name questions.

Posted: Sun Nov 10, 2013 3:28 pm
by PyTom
muniiam wrote:LOL I can't come up with a default name xD
Hiro Protagonist.

(Although, that name was used for the main character of Snow Crash.)

Re: Choosing players name questions.

Posted: Sun Dec 26, 2021 3:50 pm
by Deadpool209977
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.