ERROR; Line indented but previous doesn't expect block

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.
Post Reply
Message
Author
TigerAlpaca
Regular
Posts: 38
Joined: Tue Apr 03, 2018 4:19 am
Contact:

ERROR; Line indented but previous doesn't expect block

#1 Post by TigerAlpaca »

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/script.rpy", line 382: Line is indented, but the preceding say statement statement does not expect a block. Please check this line's indentation.
    menu:
    ^

File "game/script.rpy", line 450: Line is indented, but the preceding say statement statement does not expect a block. Please check this line's indentation.
    menu:
    ^

Ren'Py Version: Ren'Py 6.99.14.3.3347
Sat Apr 21 14:52:11 2018
These are the lines of code-
382:

Code: Select all

"There were many outraged cries but the teacher silenced them all with a flick of her hand. Ella glared at me and a note landed on my desk."
                    
                     menu:
                        
                        "Open note":
                            
                             jump falsepathruby1
                             
                        "Don't open note":
                            
                             jump neutralpath3
                             
                    label lewisdislike1:
                        
                        "I pretended I hadn't noticed, but then he picked me up and pulled me to his face height."
                        
                        "He was going to say something but thankfully Ella interrupted him."
                        
                        show lewis angry at center
                        
                        show ella shocked at left
450:

Code: Select all

h "Anyway, I have something to show you two. You wanna come, %(player_name)s?"
        
                          menu:
            
                            "Decline":
            
                              jump lewisdislike2
             
                            "Accept":
            
                               jump lewislike2
                              
                          label lewisdislike2;
                         
                               
                               r "Sorry, I have things to do."
                               
                               "Lewis looked upset and yet also annoyed at my answer. Only he could manage that look."

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: ERROR; Line indented but previous doesn't expect block

#2 Post by kivik »

Ok you're going way overboard with the indenting here. You should perhaps re-read the documentation or the source code of the Tutorial and The Question to see how code is indented.

Basically you don't need to indent the menu, because it's flowing at the same level as the dialogue.

Think of it this way - if the current line is an event / action that should happen directly after the previous event / action, then it doesn't need to be indented. If the current line is part of the previous event / action / condition, then it needs to be indented.

So your code should be something like:

Code: Select all

"There were many outraged cries but the teacher silenced them all with a flick of her hand. Ella glared at me and a note landed on my desk."
menu:
    "Open note":
        jump falsepathruby1
    "Don't open note":
        jump neutralpath3
label lewisdislike1:
    "I pretended I hadn't noticed, but then he picked me up and pulled me to his face height."
    "He was going to say something but thankfully Ella interrupted him."
    show lewis angry at center
    show ella shocked at left

Code: Select all

h "Anyway, I have something to show you two. You wanna come, %(player_name)s?"
menu:
    "Decline":
        jump lewisdislike2
    "Accept":
        jump lewislike2
label lewisdislike2;
    r "Sorry, I have things to do."
    "Lewis looked upset and yet also annoyed at my answer. Only he could manage that look."

TigerAlpaca
Regular
Posts: 38
Joined: Tue Apr 03, 2018 4:19 am
Contact:

Re: ERROR; Line indented but previous doesn't expect block

#3 Post by TigerAlpaca »

Okay, thank you. I know I went a bit overboard with the indenting- it's caused me so many problems ^^'

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: ERROR; Line indented but previous doesn't expect block

#4 Post by kivik »

Welcome to the world of Python / Ren'py development! Where indentation matters :)

It may be confusing at first, but if you've used other languages before, treat indentations as {} brackets. Each time you open a { bracket, indent. Each time you close, move back one indent block.

Post Reply

Who is online

Users browsing this forum: Andredron, Google [Bot]