About Letting The Player Choose Their Name...
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.
- Dollarluigi
- Regular
- Posts: 63
- Joined: Mon Aug 15, 2016 10:06 pm
- Completed: Winter Dream, School For The Friendless
- Tumblr: Rehnchoro
- Deviantart: Dollarluigi
- Skype: Dollarluigi
- Soundcloud: Dollarluigi
- Location: Probably Earth
- Contact:
About Letting The Player Choose Their Name...
I've already looked it up and I found a way for the player to enter their name, so I can get other characters to refer to the player as whatever name they enter, but I have a couple of questions. How do I limit the amount of characters that can be in the name and how do I get the name the player entered to appear in the text box to show when the player is talking?
Suffering a rare condition is one of the worst things you could ever experience because no one understands a thing.
YouTube Twitter Tumblr Reddit deviantArt
YouTube Twitter Tumblr Reddit deviantArt
- Katy133
- Miko-Class Veteran
- Posts: 704
- Joined: Sat Nov 16, 2013 1:21 pm
- Completed: Eight Sweets, The Heart of Tales, [redacted] Life, Must Love Jaws, A Tune at the End of the World, Three Guys That Paint, The Journey of Ignorance, Portal 2.5.
- Projects: The Butler Detective
- Tumblr: katy-133
- Deviantart: Katy133
- Soundcloud: Katy133
- itch: katy133
- Location: Canada
- Contact:
Re: About Letting The Player Choose Their Name...
I made a tutorial on naming characters.
I'll quote what you specifically wanted below:
"Length=10" means "A name that's 10 letters or characters long"
In the linked tutorial, I also included instructions on how to add custom responses to the player typing in specific names (you can use this to either prevent the player from typing in swear words or to include Easter Eggs to certain names).
Hope this helps!
I'll quote what you specifically wanted below:
Code: Select all
$ custom_name = renpy.input ("I need to name myself." length=10)
In the linked tutorial, I also included instructions on how to add custom responses to the player typing in specific names (you can use this to either prevent the player from typing in swear words or to include Easter Eggs to certain names).
Hope this helps!
Last edited by Katy133 on Tue Jun 27, 2017 10:36 am, edited 1 time in total.
- Dollarluigi
- Regular
- Posts: 63
- Joined: Mon Aug 15, 2016 10:06 pm
- Completed: Winter Dream, School For The Friendless
- Tumblr: Rehnchoro
- Deviantart: Dollarluigi
- Skype: Dollarluigi
- Soundcloud: Dollarluigi
- Location: Probably Earth
- Contact:
Re: About Letting The Player Choose Their Name...
It doesn't unfortunately.Katy133 wrote:I made a tutorial on naming characters.
I'll quote what you specifically wanted below:
"Length=10" means "A name that's 10 letters or characters long"Code: Select all
$ custom_name = renpy.input ["I need to name myself." length=10)
In the linked tutorial, I also included instructions on how to add custom responses to the player typing in specific names (you can use this to either prevent the player from typing in swear words or to include Easter Eggs to certain names).
Hope this helps!
Perhaps my code will help?
Code: Select all
$ player_name = renpy.input("What is your name?")
$ player_name = player_name.strip()
if player_name == "":
$ player_name="Matt"
Code: Select all
define p = Character('%(player_name)s', color="#0017FF")
Suffering a rare condition is one of the worst things you could ever experience because no one understands a thing.
YouTube Twitter Tumblr Reddit deviantArt
YouTube Twitter Tumblr Reddit deviantArt
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: About Letting The Player Choose Their Name...
Code: Select all
default player_name = ""
define p = Character("[player_name]", color="#0017FF")
label start:
$ player_name = renpy.input("What is your name?", length=10)
$ player_name = player_name.strip()
if player_name == "":
$player_name="Matt"
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
- Katy133
- Miko-Class Veteran
- Posts: 704
- Joined: Sat Nov 16, 2013 1:21 pm
- Completed: Eight Sweets, The Heart of Tales, [redacted] Life, Must Love Jaws, A Tune at the End of the World, Three Guys That Paint, The Journey of Ignorance, Portal 2.5.
- Projects: The Butler Detective
- Tumblr: katy-133
- Deviantart: Katy133
- Soundcloud: Katy133
- itch: katy133
- Location: Canada
- Contact:
Re: About Letting The Player Choose Their Name...
You will need to change "custom_name" to whatever tag you are currently using (in this case, "player_name"). Also, be sure you are using (brackets) and not [square brackets]Dollarluigi wrote:It doesn't unfortunately.
Perhaps my code will help?
Try this:
Code: Select all
$ player_name = renpy.input("What is your name?" length=10)
$ player_name = player_name.strip()
if player_name == "":
$ player_name="Matt"
- DannyGMaster
- Regular
- Posts: 113
- Joined: Fri Sep 02, 2016 11:07 am
- Contact:
Re: About Letting The Player Choose Their Name...
I solved this problem by making a function that changes a character's name directly.
I think this way you can refer to your character's more clearly, and even have the player name more than one character.
Code: Select all
init python:
def input_name(character):
new_name = renpy.input("What is your name?", length=9)
new_name = new_name.strip()
if not new_name: #So if the player hits enter the default name is used.
pass
else:
character.name = new_name
define m = Character("Matt") #You define the character with his/her default name
label start:
m "I'm [m.name] but you can change my name!"
$ input_name(m) #The player changes his her name here.
m "Now I'm called [m.name]!"
The silent voice within one's heart whispers the most profound wisdom.
Who is online
Users browsing this forum: No registered users