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.
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 []
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?)
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.
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?)
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.