Input player name [SOLVED]

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
Ladythief1997
Regular
Posts: 46
Joined: Tue Mar 08, 2016 6:09 pm
Projects: Unnamed PJ
Tumblr: genderbender1lover
Deviantart: genderbender-lover
Skype: mycandyloveobsession@gmail.com
Soundcloud: Breaking~Point
itch: Ladythief1997
Location: Ildis
Discord: tenshuz
Contact:

Input player name [SOLVED]

#1 Post by Ladythief1997 »

So Ive set this code in from the renpy tutorial webpage

Code: Select all

label start:
renpy.input(prompt, default='Lihana', allow=None, exclude='{None}', length=None, with_none=None, pixel_width=None)

    scene bg school
And I get this

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/script.rpy", line 22: expected statement.
    renpy.input(prompt, default='Lihana', allow=None, exclude='{None}', length=None, with_none=None, pixel_width=None)
                                                                                                                      ^

Ren'Py Version: Ren'Py 6.99.7.858
Any suggestions? Anyone at all.
Last edited by Ladythief1997 on Mon Mar 28, 2016 2:09 am, edited 1 time in total.
Writer looking for EXP go ahead and hit me up. ;D You know you want to.

User avatar
Nylan
Regular
Posts: 47
Joined: Tue Mar 08, 2016 4:11 am
Completed: Segmentation_Fault (Nano16)
Projects: Currently free
Organization: MagicEngineering
Contact:

Re: Input player name

#2 Post by Nylan »

Example from the tutorial

Code: Select all

define pov = Character("[povname]")

python:
    povname = renpy.input("What is your name?")
    povname = povname.strip()

    if not povname:
         povname = "Pat Smith"

pov "My name is [povname]!"
You set a variable to equal renpy.input (in this case, povname). Then you can use that name in a string "My name is [povname]!" or as the name of your character define pov = Character("[povname]") with the square brackets []

Hope that helps.
Image

User avatar
Ladythief1997
Regular
Posts: 46
Joined: Tue Mar 08, 2016 6:09 pm
Projects: Unnamed PJ
Tumblr: genderbender1lover
Deviantart: genderbender-lover
Skype: mycandyloveobsession@gmail.com
Soundcloud: Breaking~Point
itch: Ladythief1997
Location: Ildis
Discord: tenshuz
Contact:

Re: Input player name

#3 Post by Ladythief1997 »

That didnt work either
Writer looking for EXP go ahead and hit me up. ;D You know you want to.

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 player name

#4 Post by trooper6 »

Create a brand new project with nothing in it at all.
Put this code in it exactly as I have typed it:

Code: Select all

define pov = Character("[povname]")

default povname = "Pat Smith"

label start:
    $ povname = renpy.input("What is your name?")
    $ povname = povname.strip()

    if not povname:
         $povname = "Pat Smith"

pov "My name is [povname]!"

return
Run that code.

By the way, have you read the Renpy QuickStart in the Documentation? If you haven't, you should.
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
MimirollCookie
Miko-Class Veteran
Posts: 725
Joined: Sat May 23, 2015 5:05 am
Completed: Best Friends (DRAMA), Sweet and Spices (NaNo16)
Projects: Cupid's Wish, Best Friends Deux
Organization: Pastelle Studios
Deviantart: MimirollCookie
Location: A place where rainbows and unicorns collide. ^0^
Contact:

Re: Input player name

#5 Post by MimirollCookie »

How about trying this code for a user-input names?:

First, define the character.
Code:
define e = Character("[name]")


second, copy this code.
Code:
# The game starts here.
label start:
    $ name = renpy.input("What's your name?")
    $ name = name.strip()
    e"Hello! I'm [name]!"
    return


~Make sure to copy these!
Code:
$ name = renpy.input("What's your name?")
    $ name = name.strip()


I used this code for test projects, etc. I used this code because it's easier to type.

-Anyways, I hope it helps!



 
Image
"If they can do it, you can do it too! make them do it. They can do it, right?" :lol:
Getting a new laptop. Hopefully going back to VN making! (BWAHAHA)

User avatar
Ladythief1997
Regular
Posts: 46
Joined: Tue Mar 08, 2016 6:09 pm
Projects: Unnamed PJ
Tumblr: genderbender1lover
Deviantart: genderbender-lover
Skype: mycandyloveobsession@gmail.com
Soundcloud: Breaking~Point
itch: Ladythief1997
Location: Ildis
Discord: tenshuz
Contact:

Re: Input player name

#6 Post by Ladythief1997 »

They both work perfectly! Thanks a ton!
Writer looking for EXP go ahead and hit me up. ;D You know you want to.

User avatar
Ladythief1997
Regular
Posts: 46
Joined: Tue Mar 08, 2016 6:09 pm
Projects: Unnamed PJ
Tumblr: genderbender1lover
Deviantart: genderbender-lover
Skype: mycandyloveobsession@gmail.com
Soundcloud: Breaking~Point
itch: Ladythief1997
Location: Ildis
Discord: tenshuz
Contact:

Re: Input player name

#7 Post by Ladythief1997 »

They both work perfectly! Thanks a ton!
Writer looking for EXP go ahead and hit me up. ;D You know you want to.

User avatar
johandark
Veteran
Posts: 356
Joined: Sat Apr 30, 2016 11:04 am
Completed: Wild Guards, In Dreams
Projects: Pact with a witch
Deviantart: johandarkweb
Location: Barcelona
Contact:

Re: Input player name [SOLVED]

#8 Post by johandark »

Thanks trooper6! Your help is always glad to read.
Image

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 player name [SOLVED]

#9 Post by trooper6 »

johandark wrote:Thanks trooper6! Your help is always glad to read.
I try to be helpful within the constraints of what sorts of coding suggestions are allowed.
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

filvalente
Newbie
Posts: 1
Joined: Wed May 10, 2023 10:26 am
Contact:

Re: Input player name

#10 Post by filvalente »

MimirollCookie wrote: Sun Mar 27, 2016 10:09 pm How about trying this code for a user-input names?:

First, define the character.
Code:
define e = Character("[name]")


second, copy this code.
Code:
# The game starts here.
label start:
    $ name = renpy.input("What's your name?")
    $ name = name.strip()
    e"Hello! I'm [name]!"
    return


~Make sure to copy these!
Code:
$ name = renpy.input("What's your name?")
    $ name = name.strip()


I used this code for test projects, etc. I used this code because it's easier to type.

-Anyways, I hope it helps!



 
This one has worked for me as a glove, thanks a lot, it solved a minor problem but that is awesome.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]