Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
-
JudokaLilly
- Regular
- Posts: 44
- Joined: Sat Jan 12, 2013 3:45 am
- Deviantart: LillyInverse
-
Contact:
#1
Post
by JudokaLilly » Sat Jan 12, 2013 3:51 am
Ok, my partner and I are kind of total newbies at this, so we're hoping to get some help here. Basically, we want the player to not have a name (just show up as 'Player' in her name box) for a few scenes, then an NPC asks her "what's your name?" and the player is prompted to type in their chosen name. That all worked fine actually, the tutorials online are great! However, we're having a problem getting her name to change from "Player" to the name that the player actually types in. Here is our code so far:
Code: Select all
$ a = DynamicCharacter("Player")
define n = Character('Naki', color="#0000FF")
define u = Character('???', color="#000000")
define y = Character('Ayame', color="#FF00FF")
# The game starts here.
label start:
scene bg confront
show Aisha Happy
$ Player="Player"
a "Well, I finally made it...."
((More scenes here))
a "Oh, right! My name is...."
$ player_name = renpy.input("What is your name?")
$ player_name = player_name.strip()
if player_name == "":
$ player_name="Aisha"
$ Player="[player_name]"
a "%(player_name)s. It's nice to meet you."
Everything works fine - "n" says the player's chosen name and everything, but the player tag isn't being renamed. Any help will be greatly appreciated - thanks!
Last edited by
JudokaLilly on Sat Jan 12, 2013 2:25 pm, edited 1 time in total.
-
jayel
- Newbie
- Posts: 8
- Joined: Sun Dec 23, 2012 5:39 pm
-
Contact:
#2
Post
by jayel » Sat Jan 12, 2013 4:29 am
The problem looks like it's here:
Code: Select all
if player_name == "":
$ player_name="Aisha"
$ Player="[player_name]"
$ Player="[player_name] is written as part of the "if" block. Remove the indentation and the typed name shows up instead of Player.
Code: Select all
if player_name == "":
$ player_name="Aisha"
$ Player ="[player_name]"
-
JudokaLilly
- Regular
- Posts: 44
- Joined: Sat Jan 12, 2013 3:45 am
- Deviantart: LillyInverse
-
Contact:
#3
Post
by JudokaLilly » Sat Jan 12, 2013 4:43 am
I changed the code as you suggested, and now I'm getting a fun new error xD
"Sayer a is not defined"
-
saguaro
- Miko-Class Veteran
- Posts: 560
- Joined: Sun Feb 12, 2012 9:17 am
- Completed: Locked-In, Sunrise, The Censor
- Organization: Lucky Special Games
- itch: saguarofoo
- Location: USA
-
Contact:
#4
Post
by saguaro » Sat Jan 12, 2013 8:19 am
Define your DynamicCharacter as:
Code: Select all
define a = DynamicCharacter("player")
For your personal sanity, I would recommend using lowercase variable names. You can interpolate (display the variable) by using brackets. You want to have the player variable reference player_name directly. See my changes below.
Code: Select all
label start:
scene bg confront
show Aisha Happy
$ player = "Player"
a "Well, I finally made it...."
((More scenes here))
a "Oh, right! My name is...."
$ player_name = renpy.input("What is your name?")
$ player_name = player_name.strip()
if player_name == "":
$ player_name="Aisha"
$ player=player_name
a "[player]. It's nice to meet you."
-
JudokaLilly
- Regular
- Posts: 44
- Joined: Sat Jan 12, 2013 3:45 am
- Deviantart: LillyInverse
-
Contact:
#5
Post
by JudokaLilly » Sat Jan 12, 2013 2:24 pm
That worked - thanks so much for the help

Users browsing this forum: No registered users