Im trying to make a insert name but i keep on getting " ‘break’ outside loop"
label start:
scene black
python:
while True:
name = renpy.input("{b}Insert your name{b}")
if name.strip() == "":
me = Character("Levi", color="#00a2d3", who_outlines=[(3, "#afecff", 1, 1)],who_xpos= 600, who_ypos= 20)
break
#narrator(_("Please insert a name"))
elif len(name.strip()) > 20:
narrator(_("This name is too long..."))
else:
me = Character(name.strip(), color="#00a2d3", who_outlines=[(3, "#afecff", 1, 1)],who_xpos= 600, who_ypos= 20)
break
I try everything I know I slit get the same result, can I get and help?
1 Answer 1
There is an indentation problem in the python code. This should be the right one.
label start:
scene black
python:
while True:
name = renpy.input("{b}Insert your name{b}")
if name.strip() == "":
me = Character("Levi", color="#00a2d3", who_outlines=[(3, "#afecff", 1, 1)],who_xpos= 600, who_ypos= 20)
break
#narrator(_("Please insert a name"))
elif len(name.strip()) > 20:
narrator(_("This name is too long..."))
else:
me = Character(name.strip(), color="#00a2d3", who_outlines=[(3, "#afecff", 1, 1)],who_xpos= 600, who_ypos= 20)
break
answered Jul 29, 2024 at 20:53
Timsib Adnap
5516 silver badges16 bronze badges
Sign up to request clarification or add additional context in comments.
2 Comments
Anerdw
Sorry, this should be right: stackoverflow.com/help/privileges/flag-posts
lang-py
if,elifandelsebreakstatements outside yourwhile True:loop. Perhaps you meant all the lines following:name = renpy.input( ...to be indented.