Hello, I just created an account here and I would like to ask a (probably) very basic question.
I wanna know how to let the player chose his/her name.
I have tried to search all over and I could only find codes like the following:
Code:
define e = Character("[name]")
# The game starts here.
label start:
$ name = renpy.input("What's your name?")
$ name = name.strip()
e"Hello! I'm [name]!"
Which does not work. This code is even in the Ren'Py page itself (that is outdated).
Could someone please help me with that? Thanks in advance.
Player-name Input
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.
Re: Player-name Input
Can you clarify what you mean when you say it doesn't work?
The code above makes character e's name whatever the player inputs when displayed. So we need to know what makes you say that it doesn't - e.g. is your player a different character? Can you show us your code?
The code above makes character e's name whatever the player inputs when displayed. So we need to know what makes you say that it doesn't - e.g. is your player a different character? Can you show us your code?
- erickcire95
- Regular
- Posts: 33
- Joined: Tue Dec 26, 2017 7:38 pm
- Contact:
Re: Player-name Input
Code: Select all
define e = Character("[name]")
# The game starts here.
label start:
$ name = Character(renpy.input("What's your name?"))
e"Hello! I'm [name]!"
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3794
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Player-name Input
Indentation also matters.erickcire95 wrote: ↑Fri Jun 01, 2018 9:06 amyou are missing the character part when you ask for inputCode: Select all
define e = Character("[name]") # The game starts here. label start: $ name = Character(renpy.input("What's your name?")) e"Hello! I'm [name]!"
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Re: Player-name Input
erickcire95 wrote: ↑Fri Jun 01, 2018 9:06 amyou are missing the character part when you ask for inputCode: Select all
define e = Character("[name]") # The game starts here. label start: $ name = Character(renpy.input("What's your name?")) e"Hello! I'm [name]!"
Doesn't that make the variable name a Character??
The way the code worked was that a Character was created (called e) whose name is an interpolated string: "[name]" so whatever the variable name is, it'll be used as e's name.
Re: Player-name Input
Thank you lots, that was it.erickcire95 wrote: ↑Fri Jun 01, 2018 9:06 amyou are missing the character part when you ask for inputCode: Select all
define e = Character("[name]") # The game starts here. label start: $ name = Character(renpy.input("What's your name?")) e"Hello! I'm [name]!"
Unfortunately, I did not found any code with that "Character" part, so I hope this thread helps any newcomers with the same problem.
Also, thanks to everyone that tried to assist.
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot], LuckyT, tim640