"Line is indented, but the preceding say statement statement does not expect a block" error code

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
Vortex8th
Newbie
Posts: 5
Joined: Sat Sep 02, 2017 11:44 am
Contact:

"Line is indented, but the preceding say statement statement does not expect a block" error code

#1 Post by Vortex8th » Sat Sep 02, 2017 12:03 pm

I've tried everything that came to my mind, but I simply don't understand what causes me to get error code after error code after error code. I think, up to this point, I had about 4 or 5 different errors with just the "$ gender" line. The "Line is indented, but the preceding one-line python statement statement does not expect a block" is where I am currently stuck. All i want to do is for Renpy to remember which gender the player picked, and play the right dialogue based on that decision. But for some reason, I just can't get it to work. It's probably really easy, and I'm just too stupid to make out what it is, but any help would be massively appreciated!

Code: Select all

# The script of the game goes in this file.

image bg InteriorGoodwill = "InteriorGoodwill.jpg"
image bg White = "White.png"
image Goodwill = "Doctor.png"
image bg black = "#000"

define flash1 = Fade(.50, 0.5, .5, color="#fff")
define flash2 = Fade(0, 0.5, 0.25, color="#fff")

# Declare characters used by this game. The color argument colorizes the
# name of the character.

define e = Character("Eileen")
define None = Character("")
define Goodwill = Character("Goodwill")
define Player = Character("[name]")

label start:
    
    show bg black
    
label gender:   

    menu:
        "Please select your gender."
        
        "Male":
            jump Male
        
        "Female":
            jump Female
            
label Male:

menu:
      "Are you male?":
          
       $ gender1 = "male1"
        "Yes":
                jump name
            
        "No":
                jump gender
            
label Female:

menu:
      "Are you female?":
          
       $ gender1 = "female1"
        "Yes":
                jump name
            
        "No":
                jump gender
    
label name:
    "Please enter your name."

    $ name = renpy.input("What is your name?")

    $ name = name.strip()

    if name == "":
        $ name="Explorer"
        
    menu:
        "Is [name] your name?"
        
        "Yes":
            jump go
        
        "No":
            jump name

label go:
    
    scene bg black
    with fade    
    
    play sound "WalkingDirt.mp3"
    queue sound "Knocking.mp3"

    
    $ renpy.pause(delay=10.0, hard=True, checkpoint=False)
    
    "... ... ... ... ..."
    "... ... ... ... ..."
    
    None "Coming!"
    
    "... ... ... ... ..."
    
    None "Just... A Second..."  
    play sound "UnlockDoor.mp3"
    $ renpy.pause(delay=5, hard=True, checkpoint=False)
    
    "... ... ... ... ..."
    
    play sound "DoorOpen.mp3"
    
    scene bg White
    with flash1
    
    Goodwill "Ah! [name]! There you are! Glad you finally made it!"
    
    Goodwill "It's been such a long time, let me take a good look at you..."
    if gender1 == "male1":
        Goodwill "You definetly got your dad's nose... not that there's anything wrong with that!"
    if gender1 == "female1":
        Goodwill "You definetly got your mom's eyes... they're beautiful!"
    
    Goodwill "But enough of that now! Please, come in!"
    
    play sound "DoorClose.mp3"
    
    scene bg InteriorGoodwill
    with flash2
    
    show Goodwill
    with dissolve
    
    Goodwill "There we are!"

    return

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 40: Line is indented, but the preceding one-line python statement statement does not expect a block. Please check this line's indentation.
    "Yes":
    ^

File "game/script.rpy", line 52: Line is indented, but the preceding one-line python statement statement does not expect a block. Please check this line's indentation.
    "Yes":
    ^

Ren'Py Version: Ren'Py 6.99.12.4.2187

User avatar
Karl_C
Veteran
Posts: 232
Joined: Sun Mar 31, 2013 6:18 am
Contact:

Re: "Line is indented, but the preceding say statement statement does not expect a block" error code

#2 Post by Karl_C » Sat Sep 02, 2017 2:55 pm

Code: Select all

menu:
      "Are you male?":
          
       $ gender1 = "male1"
        "Yes":
                jump name
            
        "No":
                jump gender
            
label Female:

menu:
      "Are you female?":
          
       $ gender1 = "female1"
        "Yes":
                jump name
            
        "No":
                jump gender
Both "Yes" are intended, they are not in the same column as $ gender1...

Nero
Veteran
Posts: 242
Joined: Tue Aug 09, 2016 2:59 pm
Contact:

Re: "Line is indented, but the preceding say statement statement does not expect a block" error code

#3 Post by Nero » Sat Sep 02, 2017 4:11 pm

They are Indented but not correctly you must use TAB to Indent them the right way equally. Check your lines in code 40 and 52 by the eye you can see that they are not placed the right way.

Here is example of how it should look like:

Code: Select all

label start:
    "Game Starts"

menu:
    "Are you male?"
    "Yes":
        $ gender1 = "male1"
        jump name
            
    "No":
        jump gender

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: "Line is indented, but the preceding say statement statement does not expect a block" error code

#4 Post by trooper6 » Sat Sep 02, 2017 4:19 pm

Side note.

I'd intent the entire menu one more level so that it is clear that it is part of the start label, like so:

Code: Select all

label start:
    "Game Starts"

    menu:
        "Are you male?"
        "Yes":
            $ gender1 = "male1"
            jump name
            
        "No":
            jump gender
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

Vortex8th
Newbie
Posts: 5
Joined: Sat Sep 02, 2017 11:44 am
Contact:

Re: "Line is indented, but the preceding say statement statement does not expect a block" error code

#5 Post by Vortex8th » Sat Sep 02, 2017 7:44 pm

Great, thank you guys, I got it to work! ^_^
And thanks for the tips, I'm still new to Renpy, so I defintely have to work a lot of things out about how the script has to look. c:

TheChatotMaestro
Regular
Posts: 91
Joined: Mon Jul 31, 2017 8:33 am
Deviantart: LedianWithACamera
Contact:

Re: "Line is indented, but the preceding say statement statement does not expect a block" error code

#6 Post by TheChatotMaestro » Sun Sep 03, 2017 7:24 pm

I know you've already gotten it working, but if you wanted to simplify it and make it look slightly less awkward, maybe just have one menu?

Code: Select all

 menu:
        "Are you a male or a female?"
        "Male":
            $ gender1 = "male1"
            jump name
            
        "Female":
            $ gender1 = "female1"
            jump name

Post Reply

Who is online

Users browsing this forum: Google [Bot]