how does a player enter a name for the MC? [solved]
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.
- Cidz
- Veteran
- Posts: 458
- Joined: Wed Jul 27, 2011 1:50 pm
- Completed: The Forgetful Kiwi [NanoReno 2012], Papercut [NanoReno 2013]
- Projects: Words Within Our Hearts, Papercut [NanoReno 2013]
- Organization: Starlight Melodies
- Tumblr: starlightmelodies
- Deviantart: cidthekitty
- Location: California, USA
- Contact:
how does a player enter a name for the MC? [solved]
I was wondering what the code is for a player to enter a name for the MC? i tried looking around the wiki, document, FAQs, and cookbook, but i didn't find anything. maybe I'm just not looking hard enough?
also how do i program it so that the name shows up every time either the MC speaks or someone calls the MC by their name.
also how do i program it so that the name shows up every time either the MC speaks or someone calls the MC by their name.
Last edited by Cidz on Sun Jan 01, 2012 4:32 am, edited 3 times in total.
- Camille
- Eileen-Class Veteran
- Posts: 1227
- Joined: Sat Apr 23, 2011 2:43 pm
- Completed: Please see http://trash.moe
- Projects: the head well lost
- Organization: L3
- Tumblr: narihira
- Deviantart: crownwaltz
- itch: lore
- Contact:
Re: how does a player enter a name for the MC?
Here you go. There's more info on DynamicCharacter here on the wiki. And then every time you want the MC's name to show up, just do [namevariable]. If you're not using 6.13, then do %(namevariable)s.
- Cidz
- Veteran
- Posts: 458
- Joined: Wed Jul 27, 2011 1:50 pm
- Completed: The Forgetful Kiwi [NanoReno 2012], Papercut [NanoReno 2013]
- Projects: Words Within Our Hearts, Papercut [NanoReno 2013]
- Organization: Starlight Melodies
- Tumblr: starlightmelodies
- Deviantart: cidthekitty
- Location: California, USA
- Contact:
Re: how does a player enter a name for the MC?
thank you very much <3333
- Cidz
- Veteran
- Posts: 458
- Joined: Wed Jul 27, 2011 1:50 pm
- Completed: The Forgetful Kiwi [NanoReno 2012], Papercut [NanoReno 2013]
- Projects: Words Within Our Hearts, Papercut [NanoReno 2013]
- Organization: Starlight Melodies
- Tumblr: starlightmelodies
- Deviantart: cidthekitty
- Location: California, USA
- Contact:
Re: how does a player enter a name for the MC?
i shouldnt of put solved so soon im running into a small problem.
how do i make the user chosen name appear like in the name box?
for example it shows up fine when a char says my name
but when MC speaks it doesnt show up see
the name code i used is this:
and the code i used so that the name shows up when MC speaks is this
do i need to enter a different code for it to show?
how do i make the user chosen name appear like in the name box?
for example it shows up fine when a char says my name
but when MC speaks it doesnt show up see
the name code i used is this:
Code: Select all
# 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("Enter a 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=""
# And get a nostalgic sigh from Seasons of Sakura fans!
# Now the other characters in the game can greet the player.
Code: Select all
define n = Character('%(player_name)s')
-
- Regular
- Posts: 98
- Joined: Sat Dec 31, 2011 7:05 pm
- Projects: Kangaroo, Terminal Love
- Location: DC
- Contact:
Re: how does a player enter a name for the MC?
It's not terribly difficult to implement. Here's an example from 6.10.2:
Code: Select all
init:
$ povname = ""
$ pov = DynamicCharacter("povname", color="#BF2A78")
$ povname = renpy.input("What is your name?") or "Alfred"
pov "I'm %(povname)s."
Last edited by MoPark on Sun Jan 01, 2012 2:10 am, edited 1 time in total.
-
- Miko-Class Veteran
- Posts: 758
- Joined: Tue Jun 22, 2010 12:54 am
- Completed: Christmas
- IRC Nick: DragoonHP
- Location: Zion Island, Solario
- Contact:
Re: how does a player enter a name for the MC?
@Cidz: Newer version of Ren'Py had some changes, one of them were changing the syntax of Ren'Py interpolation...
Try MoPark example but instead of this...
use this
Try MoPark example but instead of this...
Code: Select all
pov "I'm %(povname)s."
Code: Select all
pov "I'm [povname]."
-
- Regular
- Posts: 98
- Joined: Sat Dec 31, 2011 7:05 pm
- Projects: Kangaroo, Terminal Love
- Location: DC
- Contact:
Re: how does a player enter a name for the MC?
Okay I was dumb in my reply and forgot to include the first two lines under init:
My apologies!
My apologies!
- Cidz
- Veteran
- Posts: 458
- Joined: Wed Jul 27, 2011 1:50 pm
- Completed: The Forgetful Kiwi [NanoReno 2012], Papercut [NanoReno 2013]
- Projects: Words Within Our Hearts, Papercut [NanoReno 2013]
- Organization: Starlight Melodies
- Tumblr: starlightmelodies
- Deviantart: cidthekitty
- Location: California, USA
- Contact:
Re: how does a player enter a name for the MC?
@ MoPark and DragoonHP - Thank you! I will try that.
I don't have the newest version of renpy maybe I should try. I have version 6.12.1
I don't have the newest version of renpy maybe I should try. I have version 6.12.1
-
- Miko-Class Veteran
- Posts: 758
- Joined: Tue Jun 22, 2010 12:54 am
- Completed: Christmas
- IRC Nick: DragoonHP
- Location: Zion Island, Solario
- Contact:
Re: how does a player enter a name for the MC?
I believe that it was already changed in Ren'Py 12
- Cidz
- Veteran
- Posts: 458
- Joined: Wed Jul 27, 2011 1:50 pm
- Completed: The Forgetful Kiwi [NanoReno 2012], Papercut [NanoReno 2013]
- Projects: Words Within Our Hearts, Papercut [NanoReno 2013]
- Organization: Starlight Melodies
- Tumblr: starlightmelodies
- Deviantart: cidthekitty
- Location: California, USA
- Contact:
Re: how does a player enter a name for the MC?
hmm... now im having another problem. i used the code and i made a seperate name file in renpy, tested it out. works great. So then i input it into my game script and now its giving me and error
heres the code in my game.
i even tried [povname] instead still nothing. sorry to be such a bother I'm just new to coding.
heres the code in my game.
Code: Select all
label start:
init:
$ povname = ""
$ pov = DynamicCharacter("povname", color="#BF2A78")
$ povname = renpy.input("What is your name?") or "Alfred"
pov "I'm %(povname)s."
-
- Veteran
- Posts: 279
- Joined: Thu Jul 14, 2011 1:50 pm
- Organization: TwinTurtle Games
- Contact:
Re: how does a player enter a name for the MC?
I'll just give you the code I'm using >_>
When defining characters, do it as so:
And in the script, allow the player to chose a name like this.
This code will show a default name, and the player can delete it and input a name of their own if they want. Remember to always update to the latest version of Ren'Py, although I think this should work with the 6.12.1 version.
When defining characters, do it as so:
Code: Select all
define p = DynamicCharacter('player_name', color = "#58D3F7")
Code: Select all
$ player_name = renpy.input("What is your first name?", "Bobert", length=20)
p"My name is[player_name]! Yayz~!"
I've swapped accounts to CheeryMoya, so this account is no longer in use. Refer to the new account if you want to contact me.
Twinturtle Games Website
Twinturtle Games Website
- Cidz
- Veteran
- Posts: 458
- Joined: Wed Jul 27, 2011 1:50 pm
- Completed: The Forgetful Kiwi [NanoReno 2012], Papercut [NanoReno 2013]
- Projects: Words Within Our Hearts, Papercut [NanoReno 2013]
- Organization: Starlight Melodies
- Tumblr: starlightmelodies
- Deviantart: cidthekitty
- Location: California, USA
- Contact:
Re: how does a player enter a name for the MC?
it works! perfectly! thank you so much!
also i updated renpy and now have the latest version.
thank you everyone for your help.
also i updated renpy and now have the latest version.
thank you everyone for your help.
-
- Miko-Class Veteran
- Posts: 758
- Joined: Tue Jun 22, 2010 12:54 am
- Completed: Christmas
- IRC Nick: DragoonHP
- Location: Zion Island, Solario
- Contact:
Re: how does a player enter a name for the MC? [solved]
You had indentations problem in your code...
This should work fine...
Code: Select all
label start:
init:
$ povname = " "
$ pov = DynamicCharacter("povname", color="#BF2A78")
$ povname = renpy.input("What is your name?") or "Alfred"
pov "I'm [povname]."
- Cidz
- Veteran
- Posts: 458
- Joined: Wed Jul 27, 2011 1:50 pm
- Completed: The Forgetful Kiwi [NanoReno 2012], Papercut [NanoReno 2013]
- Projects: Words Within Our Hearts, Papercut [NanoReno 2013]
- Organization: Starlight Melodies
- Tumblr: starlightmelodies
- Deviantart: cidthekitty
- Location: California, USA
- Contact:
Re: how does a player enter a name for the MC? [solved]
ah thank you <3 i figured it out now.
- eternalwishess
- Regular
- Posts: 77
- Joined: Sat Jul 30, 2011 9:18 pm
- Contact:
Re: how does a player enter a name for the MC? [solved]
I had that error a moment ago....im glad i found this before posting a new topic about the same problem. Thanks all ^__^
Call me αίкσ, hehe. C:
Who is online
Users browsing this forum: No registered users