pythonrenpy

Renpy ‘break’ outside loop


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?


Solution

  • 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