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.
f "Oh! i forgot your name, what was it again?"
screen input(prompt):
window at truecenter:
xmaximum 500
background Image("gui/nameinput.png")
vbox:
xalign 0.5
yalign 0.5
text prompt style "input_prompt"
input id "input"
python:
name = renpy.input("What is your name?")
name = name.strip() or "Human"
show f happy 1 with dissolve
f "Oh yeah! it's [name], right?"
For example, the player types "Fina", and when after he inputs that, the real "Fina" character will say a thing, and let the player to choose again, vice versa for all character names.
This should do what you're looking for. It uses a sub-label (notice the label name starts with a dot) to jump back to the prompt each time the user enters the disallowed name.
label getting_to_know_you:
f "Oh! i forgot your name, what was it again?"
label .prompt_for_name:
$ name = renpy.input("What is your name?").strip() or "Human"
if name == f.name: # could hard code the name if you prefer using: name == "Fina"
f "Whoops! That is my name, how about something else?"
jump .prompt_for_name
show f happy 1 with dissolve
f "Oh yeah! it's [name], right?"
return
jump choosename
label choosename:
python:
name = renpy.input("What is your name?")
name = name.strip() or "Human"
if name=="Fina":
f "Whoops! That is my name, how about something else?"
jump choosename
else:
f "Oh yeah! it's [name], right?"
Something like this. Putting this under a label will allow the game to return there after the wrong name choice and, well, "if-else" statements are self-explanatory.
; )
~There is almost always a better, easier way to approach a problem.~