Input name in game

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.
Post Reply
Message
Author
User avatar
NayraSoul
Newbie
Posts: 6
Joined: Mon Oct 07, 2013 9:05 am
Contact:

Input name in game

#1 Post by NayraSoul »

I know how to let the player choose the main character name (%(player_name)s) but what's the function to make it appear when the main character speaks?

Example:

Boy: Hey, %(player_name)s, stop!
%(player_name)s: I can't!

I need a little bit help xD

User avatar
jesusalva
Regular
Posts: 88
Joined: Mon Jul 22, 2013 5:05 pm
Organization: Software in Public Interest, Inc.
IRC Nick: jesusalva
Github: pazkero
itch: tmw2
Location: Brazil
Discord: Jesusalva#4449
Contact:

Re: Input name in game

#2 Post by jesusalva »

OK, I've read that somewhere in LSF or Renpy Documentation:

Code: Select all

init:
    $ povname = ""

    # And this is a DynamicCharacter that has the same stored in
    # povname.
    $ pov = DynamicCharacter("povname", color=(192, 64, 64, 255))
label start:
    $ povname = renpy.input("What is your name?") or "NayraSoul"
    "Boy" "Stop, [povname]!"
    pov "I can't!"
Tested, DynamicCharacter() do the work.
Very common, so, with a bit more of search, you find Documentation for it.
Jesusaves/Jesusalva

User avatar
NayraSoul
Newbie
Posts: 6
Joined: Mon Oct 07, 2013 9:05 am
Contact:

Re: Input name in game

#3 Post by NayraSoul »

When i put:

"Boy" "Stop, [povname] !"

The result is povname, not the name chosen.

Elmiwisa
Veteran
Posts: 476
Joined: Sun Jul 21, 2013 8:08 am
Contact:

Re: Input name in game

#4 Post by Elmiwisa »

Do you use an old version of Ren'Py, or use a new one but disable that feature anyway?

User avatar
NayraSoul
Newbie
Posts: 6
Joined: Mon Oct 07, 2013 9:05 am
Contact:

Re: Input name in game

#5 Post by NayraSoul »

I use Ren'py 6.10.2

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Input name in game

#6 Post by trooper6 »

Is there a reason you haven't updated to the newest Renpy?
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

User avatar
NayraSoul
Newbie
Posts: 6
Joined: Mon Oct 07, 2013 9:05 am
Contact:

Re: Input name in game

#7 Post by NayraSoul »

I downloaded it yesterday, the first version I saw, I didn't knew what was the new one XDU It's that the problem?

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Input name in game

#8 Post by trooper6 »

It might be the problem. I know that [povname] is the current way of doing things with variables and that %(povname)s is the old way of doing things...so there may be some sort mixup there. I'd try the [povname] style after you have updated to the newest renpy and see if that fixes things.
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

User avatar
NayraSoul
Newbie
Posts: 6
Joined: Mon Oct 07, 2013 9:05 am
Contact:

Re: Input name in game

#9 Post by NayraSoul »

Thanks, I updated it and it works perfect!

Post Reply

Who is online

Users browsing this forum: No registered users