Expected Statement Errors

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
vaticidalprophet
Newbie
Posts: 2
Joined: Sun Sep 30, 2018 10:54 am
Contact:

Expected Statement Errors

#1 Post by vaticidalprophet »

I get expected statement errors relatively often, and have...close to no idea what causes them. I've debugged them successfully previously, but mostly by making random changes until they disappeared and hoping I can reproduce them next time. I've read a great variety of previous error threads on this topic and found most of them wanting -- in particular, most expected statement errors seem to occur in actual code, while mine all occur during the writing/dialogue/not-that-much-coding stage.

Here's my current Ren'py error screen:

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 755: expected statement.
    "Intelligent":
                 ^

File "game/script.rpy", line 758: expected statement.
    "Creative":
              ^

File "game/script.rpy", line 761: expected statement.
    "Charismatic":
                 ^

File "game/script.rpy", line 768: Line is indented, but the preceding nvl clear statement statement does not expect a block. Please check this line's indentation.
    t "But outside of your club, would you prefer to think of yourself as more Creative, Charismatic, or Vicious?"
    ^

File "game/script.rpy", line 791: expected statement.
    "Intelligent":
                 ^

File "game/script.rpy", line 794: expected statement.
    "Charismatic":
                 ^

File "game/script.rpy", line 797: expected statement.
    "Vicious":
             ^

File "game/script.rpy", line 808: expected statement.
    "Intelligent":
                 ^

File "game/script.rpy", line 811: expected statement.
    "Creative":
              ^

File "game/script.rpy", line 814: expected statement.
    "Vicious":
             ^

File "game/script.rpy", line 823: Line is indented, but the preceding nvl clear statement statement does not expect a block. Please check this line's indentation.
    t "Goddamn, you're pretentious for a Japanese girl."
    ^

File "game/script.rpy", line 841: Line is indented, but the preceding nvl clear statement statement does not expect a block. Please check this line's indentation.
    t "I mean, you're a very captivating person."
    ^

File "game/script.rpy", line 855: Line is indented, but the preceding nvl clear statement statement does not expect a block. Please check this line's indentation.
    t "Every rule has an exception."
    ^

File "game/script.rpy", line 869: Line is indented, but the preceding nvl clear statement statement does not expect a block. Please check this line's indentation.
    t "That's what I like to hear. Use your powers for good, okay?"
    ^

File "game/script.rpy", line 881: Line is indented, but the preceding nvl clear statement statement does not expect a block. Please check this line's indentation.
    t "Well, I'll leave you to it."
    ^

File "game/script.rpy", line 1075: expected statement.
    "Yes":
         ^

File "game/script.rpy", line 1078: expected statement.
    "No":
        ^

File "game/script.rpy", line 1185: expected statement.
    "Yes":
         ^

File "game/script.rpy", line 1188: expected statement.
    "No":
        ^

Ren'Py Version: Ren'Py 7.1.0.882
Sat Nov 10 12:37:40 2018
(I'm also not sure what's up with the indentation errors, and have about the same debugging issues when faced with them.)

Here's my code. I expect the whole thing is kind of a mess, so I wasn't entirely sure how much to show and went with the first part of the plot to give me this set of errors. I tried to spoiler it for length, but it didn't work.

Code: Select all

label cafe:

    scene bg cafe

    "It's 11:45 the next day."

    "You're in a nice little place, with giant cake slices and those crazy milkshakes."

    scene bg phone

    "The message comes in."

    nvl clear

    t "Is she there yet?"

    ac "Nope."

    t "Random question, I know, but when did you learn English? You're very fluent."

    ac "I started at ten or eleven, I think. Online friends."

    t "That'd do it. The only other fluent speaker I knew from Japan was raised bilingual."

    nvl clear

    t "What club were you in at school?"

    ac "Are you hosting a trivia game about my life or something?"

    t "Just friendly curiosity."

    menu:

        "So, what club were you in?"

        "Kendo Club":
            jump kendo

        "Literature Club":
            jump lit

        "Occult Club":
            jump occult

        "Student Council":
            jump council

label kendo:

    $ Viciousness = true

    nvl clear

    t "Must be tougher than you look, then?"

    ac "Guess you could say that."

    jump traitvic

label lit:

    $ Intelligence = true

    nvl clear

    t "I bet you think you're smart, don't you?"

    ac "I mean, I {i}am{/i} smart."

    t "You're an international student at a fourth-tier public university. How'd those entrance exams go?"

    ac "Fuck off."

    jump traitint

label occult:

    $ Creativity = true

    nvl clear

    t "You going to try and hex me?"

    ac "We mostly just played around."

    t "Any demon-summoning?"

    ac "Well, there was that one time..."

    jump traitcre

label council:

    $ Charisma = true

    nvl clear

    t "Is it true the student council basically controls everything in Japanese schools?"

    ac "Anime is not real life."

    t "Yeah, but like, if it {i}was{/i}..."

    jump traitcha

label traitvic:

    nvl clear

    t "But outside of your club, would you prefer to think of yourself as more Intelligent, Creative, or Charismatic?"

    menu:

        "Try to sum up your special unique individual self":

            "Intelligent":
                jump stint

            "Creative":
                jump stcre

            "Charismatic":
                jump stcha

label traitint:

nvl clear

    t "But outside of your club, would you prefer to think of yourself as more Creative, Charismatic, or Vicious?"

    menu:

        "Try to sum up your special unique individual self":

            "Creative":
            jump stcre

            "Charismatic":
            jump stcha

            "Vicious":
            jump stvic

label traitcre:

    t "But outside of your club, would you prefer to think of yourself as more Intelligent, Charismatic, or Vicious?"

    menu:

        "Try to sum up your special unique individual self":

            "Intelligent":
            jump stint

            "Charismatic":
            jump stcha

            "Vicious":
            jump stvic

label traitcha:

    t "But outside of your club, would you prefer to think of yourself as more Intelligent, Creative, or Vicious?"

    menu:

        "Try to sum up your special unique individual self":

            "Intelligent":
            jump stint

            "Creative":
            jump stcre

            "Vicious":
            jump stvic

label stint:

$ Intelligence = true

nvl clear

    t "Goddamn, you're pretentious for a Japanese girl."

    ac "What does that have to do with it?"

    t "I used to know this chick who was a world-class violinist, you ask her and she'd tell you she was just 'a little good' at it. You know where she is now? Fucking Tokyo orchestra, she still thinks that."

    ac "How did you two know each other?"

    t "Actually, on second thought, we're never talking about this again."

    jump endconvo

label stcha:

$ Charisma = true

nvl clear

    t "I mean, you're a very captivating person."

    ac "You think?"

    t "I hope."

    jump endconvo

label stcre:

$ Creativity = true

nvl clear

    t "Every rule has an exception."

    ac "What do you mean?"

    t "You know exactly what I mean."

    jump endconvo

label stvic:

$ Viciousness = true

nvl clear

    t "That's what I like to hear. Use your powers for good, okay?"

    ac "Isn't there, like...the implication assholes {i}don't{/i} use their powers for good?"

    t "It's the thought that counts."

    jump endconvo

label endconvo:

nvl clear

    t "Well, I'll leave you to it."

    nvl clear

    scene bg cafe

    "He signs out."

    "You realize he never bothered to actually say how you two were going to meet up."

    scene bg kayleecafe1

    "She walks in."

    "She's alone, which strikes you as odd from your understanding of American high school movies."

    "Wait, are people more alone in college than high school? Should've watched different movies."

    "You realize you're staring."

    scene bg kayleecafe2

    "She realizes too, but doesn't seem too torn up about it."

    scene bg kayleecafefull

    k "Aiko, right?"

    scene bg kayleecafe3

    a "How do you know my name?"

    "Well, that's a great opening."

    k "Oh, I saw you at orientation."
    a "Right."
    k "You settling into America well?"
    a "...I guess."

    "She grins broadly, like an idiot."

    k "That's great to hear!"

    "Seems she thinks {i}you're{/i} the idiot here."

    k "Can I sit here?"
    a "Feel free."
    k "Thanks! Just tell me if you want to be alone, okay?"

    "Ha. No."

    "She orders some weird low-carb sandwich, while you're happy to just die of starvation here."

    scene bg kayleecafe4

    "Between bites of her stupid sandwich, she's all too happy to involve you in her life."

    k "So is America everything you hoped it'd be?"

    "Are you supposed to answer this question?"

    a "Yeah."
    k "Why'd you come here, anyway? I mean, Trump, you know?"

    "You grimace. It's not because of politics, either."

    menu:

        "Why did you come here?":

            "You have your reasons":
                jump noreason

            "You have American friends":
                jump friends

            "You have...someone else":
                jump takumi

label noreason:

    a "I just...wanted to."

    "She pauses, watches you for a second, searching for the real reason in your poker face."

    k "Fair enough. I mean, we all just want to go on an adventure sometimes, don't we?"
    a "Yeah."

    "You force a chuckle. She doesn't seem to think it's too fake."

    jump nextconvo

label friends:

    a "I've had friends in America."
    k "Like, online friends?"

    "You can't quite tell if there's judgement in her voice."

    a "Yeah, like online friends."
    k "Is that why you speak English so well?"
    a "I'd like to hope I'm pretty good..."

    "You play it off modestly, like an idiot who doesn't know she's Japan's only fluent Anglophone."

    k "Yeah, you're really good!"
    a "Thank you."
    k "So do any of them go here, or what?"
    a "Oh no, that was all a while ago..."

    "You let it trail off, an empty smile playing at your lips."

    jump nextconvo

label takumi:

    $ Trauma == Trauma + 1

    "You're really going to do this, aren't you?"

    a "I used to, ah...know a boy."

    "Her attention perks up, and you seriously consider shooting yourself in the face."

    a "He was...half-American, you know?"
    k "His dad was from here?"

    "She corrects herself suddenly, in the pursuit of political correctness."

    k "Or his mom?"
    a "His dad."
    k "Was he your boyfriend?"

    "You swallow the terror welling up in your throat."

    a "Yeah, kind of."

    "She giggles. A stabbing pain flashes through your head."

    a "So I, uh -- I wanted to know where he came from."
    k "Is it what you imagined?"

    "It's better."

    a "I guess."

    "You smile blankly, trying to convince her. Or yourself."

    jump nextconvo

label nextconvo:

    $ Trauma == Trauma + 1

    "She definitely thinks you're weird."

    "Well, she's not wrong."

    "Without thinking, you blurt out --"

    a "So how did you meet Jonah?"

    "Fuck."

    "She laughs. Doesn't seem to interpret it as a mortal insult."

    k "Oh, you know, we were in junior year."
    k "He was the sad boy who wrote poetry. It's a type, you know?"
    k "I was a bit of a bitch then, really, and I was supposed to be out of his league, but I'm a sucker for those guys."
    k "And he was {i}scary{/i} smart. Like, seriously, he could probably save the world if he wanted."

    "He could start by saving yours."

    k "So, um, he wrote me a poem."

    "A smile plays at her lips as she says it."

    k "On a typewriter!"
    k "During lunch!"
    k "You need guts to do that."

    "You need guts to sit here and listen to this. Yours seem to be doing backflips."

    k "He just...handed it to me. It was a really good poem, actually -- I still have it back home. Can't do it from memory, though."
    k "And we just went on a date that night."

    "She beams over at you."

    k "Pretty cool, huh?"

    menu:

        "Well, is it?":

            "Yes":
                jump cool

            "No":
                jump notcool

label cool:

    "You hold back the bile in your throat."

    a "Yeah, that sounds...really romantic."
    k "I know!"

    "It's not holding back. You jump up --"

    scene bg kayleecafe5

    a "Hey, I just need to go to the bathroom real quick --"

    scene bg toiletsick

    "Before she can reply, you're there, throwing up."

    scene bg toiletafter

    "Once you've successfully thrown up all your internal organs, you lie on the dirty floor, catatonic."

    "Despite everything, there's a sense of peace inside you."

    "He's done it before, and he can do it again."

    "You wait it out until you're sure she's left. Half an hour later, you emerge."

    scene bg cafeafter

    "Your suspicion was right. She even paid for you, though in fairness you just had some tea."

    "You're in a daze as you head back to the dorm. But your head isn't splitting anymore."

    jump dormafter

label notcool:

    $ Trauma == Trauma + 2

    "Your head is splitting."

    "Her dumb fucking grin just rubs it in."

    a "Why do you think that?"

    "She's taken aback."

    k "Sorry?"

    "You get out of your chair, and barely believe it when your legs don't collapse under you."

    scene bg kayleecafe6

    a "How is it {i}cool{/i} for you to take what isn't yours?"
    k "I --"
    a "Shut up."

    "She's trembling."

    a "You said it yourself. You don't deserve him."
    k "No I didn't --"
    a "I told you, {i}shut the fuck up.{/i}"
    a "This is what you deserve."

    "You're barely upright. Your vision is full of auras, your head is going to explode."

    "She's offended by that one --"

    k "I deserve to be happy and have a boyfriend who loves me?"

    "Your voice gurgles."

    a "You deserve to suffer."

    "You scrunch your eyes closed, like it'll help, and stagger out of the cafe."

    scene bg cafeoutside

    "It doesn't."

    scene bg cafecollapse

    "You've just made it out when you collapse."

    "Kaylee saw it and rushed to help. Bitch."

    scene bg cafecollapse2

    "By the time the ambulance comes, you're upright and can convince them you're fine. They still don't want you driving."

    "By sheer coincidence, Clara's there."

    scene bg claracar

    c "Didn't go how you expected it, huh?"

    "You can barely talk."

    c "Well, you don't have to talk about it if you don't want to."

    menu:

        "Do you?":

            "Yes":
                jump yestalk

            "No":
                jump notalk

label notalk:

    "You feel too out of it to even reply."

    "She shrugs, commits herself to the silence."

    jump dormafter

label yestalk:

    "You sigh, rub the imaginary blood from your eyes."

    a "I just got stressed, okay?"
    c "Stressed enough to yell incoherently and collapse. Got it."
    a "Was I incoherent?"
    c "Depends how you define your terms. It was pretty bad, is what I'm saying."

    "You squirm."

    c "Well, no use getting worked up about it."
    a "I guess..."
    c "Was that your first migraine?"
    a "Is that what it is?"

    "She's got her answer."

    c "I used to have them, too. Don't get too worried about a single one."
    a "It's not, like, a brain tumour or anything?"

    "With a bitter smile --"

    c "The good news is, it doesn't kill you."
    c "The bad news is, it doesn't kill you."
    c "But like I said. One-off. You'll be fine."

    "She keeps driving down. You notice she doesn't seem to be headed for the dorm."

    "You open your mouth to ask, but she gets there first."

    c "We're going to my place, by the way."
    a "Why?"
    c "Do you really want to be in the same building as her?"

    "She's got a point."

    a "I just want Jonah."
    c "Keep working on it."

    "She grins back at you, like she's played this game before."

    scene bg driveway

    "The car pulls into the driveway. It's a shitty student townhouse that, considering this is California, could probably sell for a million dollars."

    c "So you haven't met Damon yet?"
    a "No."
    c "You'll like him."

    "She tries to open the door, but her keys won't fit the lock."

    c "Fuck."
    a "Hm?"
    c "I forgot we changed the locks."
    c "And I forgot to get my keys cut."
    c "He'll be back in like an hour, but you don't look like you want to stand out here too long."
    a "Do I really look that bad?"
    c "Aiko, I say this as a friend -- you look awful."

    "You do feel a little bit on the brink of death."

    "She sighs."

    c "I'll drive you back."

    jump dormafter

label dormafter:

    scene bg dorm1

    "You make it back, one way or another, and curl up on the bed trying not to throw up."

    "You have to get rid of her."

    "You have to."

    "You have to have to have to have to have to --"

    "Well, no use working yourself up into a frenzy yet."

    "How are you going to do this, anyway?"

    "There's a great big wide world out there, you know."

    "Maybe you could kill her. That's a classic."

    "Maybe death is too good for her."

    $ if Viciousness = true
    jump dormvic

    $ if Creativity = true
    jump dormcre

    $ if Intelligence = true
    jump dormint

    $ if Charisma = true
    jump dormcha

label dormvic:

    "Maybe you could just...keep her here. Forever."

    jump dormcont

label dormcre:

    "Maybe you could try a little manipulation."

    "You know those people who get cyberbullied into suicide?"

    "God, for something that's supposed to be serious, 'cyberbullying' is a {i}stupid{/i} word."

    jump dormcont

label dormint:

    "You could just convince her it's over."

    "Everything ends someday."

    "Well, except this."

    jump dormcont

label dormcha:

    "There's always trying to befriend her."

    "To be fair, you tried one conversation and almost passed out."

    "It's a work in progress!"

    jump dormcont

label dormcont:

    ""

    # This ends the game.

    return

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Expected Statement Errors

#2 Post by Remix »

All your menus have colons after the caption lines (and extra indentation)

Code: Select all

    menu:

        "Well, is it?" # This is a Caption (not a choice) so it has No colon :

        "Yes": # This is a choice so it does have a colon (un-indented by 4 spaces from your version)
            jump cool

        "No":
            jump notcool
Frameworks & Scriptlets:

vaticidalprophet
Newbie
Posts: 2
Joined: Sun Sep 30, 2018 10:54 am
Contact:

Re: Expected Statement Errors

#3 Post by vaticidalprophet »

Remix wrote: Sat Nov 10, 2018 11:21 am All your menus have colons after the caption lines (and extra indentation)

Code: Select all

    menu:

        "Well, is it?" # This is a Caption (not a choice) so it has No colon :

        "Yes": # This is a choice so it does have a colon (un-indented by 4 spaces from your version)
            jump cool

        "No":
            jump notcool
The problem is that this gives me an entirely different error message that explicitly asks if I forgot a colon.

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Expected Statement Errors

#4 Post by Remix »

That error is more likely from one of the other made up syntax parts, like:

Code: Select all

    $ if Viciousness = true
    jump dormvic

    $ if Creativity = true
    jump dormcre
Just use

Code: Select all

    if Viciousness:
        jump dormvic
What I showed before is the Only Valid basic syntax for menus...

try it... create a new project, put it in a start label, test it...

Then fix all your menus and indentation to mimic it and then start chasing the host of other syntax errors...

If you have a blank project test area always around, you can easily test whether guesswork syntax works without burying it in the middle of a large project.
Frameworks & Scriptlets:

Post Reply

Who is online

Users browsing this forum: Google [Bot]