-7

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?

asked Jul 29, 2024 at 20:35
2
  • An indentation is missing in the if, elif and else Commented Jul 29, 2024 at 20:37
  • 3
    You have your break statements outside your while True: loop. Perhaps you meant all the lines following: name = renpy.input( ... to be indented. Commented Jul 29, 2024 at 20:37

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

2 Comments

There's a flag reason for "typo/not reproducible" - I'd rather you use that than answer the question.
Sorry, this should be right: stackoverflow.com/help/privileges/flag-posts

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.