What's wrong in my 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
User avatar
MiniDarkOF
Newbie
Posts: 4
Joined: Sun Oct 21, 2018 5:26 pm
Organization: UniversoRandom Studio & E.M Studio
IRC Nick: MiniDarkOF
Location: São Paulo, Brazil
Contact:

What's wrong in my code?

#1 Post by MiniDarkOF »

I'm trying to create a "choice system"
but this happens:

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 70: menu statement expects a non-empty block.
    menu:
        ^

File "game/script.rpy", line 71: expected statement.
    "Sai Daqui rapá, sou homem!":
                                ^

File "game/script.rpy", line 74: expected statement.
    "Tudo bem, mas o que aconteceu?":
                                    ^

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

File "game/script.rpy", line 81: Line is indented, but the preceding hide statement statement does not expect a block. Please check this line's indentation.
    "-10 de amizade com Steve (Waifu)"
    ^

File "game/script.rpy", line 93: Line is indented, but the preceding show statement statement does not expect a block. Please check this line's indentation.
    s "Sério? Senpai... você brigou com uns caras e ai caiu na rua..."
    ^

File "game/script.rpy", line 98: Line is indented, but the preceding scene statement statement does not expect a block. Please check this line's indentation.
    s "Senpai... você é tão..."
    ^

File "game/script.rpy", line 107: Line is indented, but the preceding with statement statement does not expect a block. Please check this line's indentation.
    "+3 de Amizade com Steve (Waifu)"
    ^

Ren'Py Version: Ren'Py 7.1.1.929
Sun Oct 21 18:30:44 2018
My Code (ignore "Steve Waifu" it's a joke XD)

Code: Select all

menu:
    "Sai Daqui rapá, sou homem!":
         jump anger1

    "Tudo bem, mas o que aconteceu?":
         jump romantic1

    label anger1:
     show steve waifu sad
      s "Desculpa!"
     hide steve waifu sad
      "-10 de amizade com Steve (Waifu)"
      "-15 de amor com Steve (Waifu)"
     scene bg city-street1
     with Dissolve(.5)

     pause .5

     scene chc_stop1
     with Dissolve(.5)

    label romantic1:
     show steve waifu normal
      s "Sério? Senpai... você brigou com uns caras e ai caiu na rua..."
      You "ah muito obrigado, você é muito gentil"
      s "..."
     hide steve waifu normal
     scene cutscene1
      s "Senpai... você é tão..."
      s "Tchau!"
     scene cutscene1
     with Dissolve(.5)

     pause .5

     scene chc_stop1
     with Dissolve(.5)
      "+3 de Amizade com Steve (Waifu)"
      "+1 de Amor com Steve (Waifu)"
      you "o que eu deveria fazer agora?"

return
Emanuel Messias, R.d.S - A.K.A MiniDarkOF
São Paulo, Brasil

User avatar
Dinocanid
Newbie
Posts: 7
Joined: Thu Jul 26, 2018 7:04 pm
Projects: Twilight in Dogtown
Organization: Saurus Studios
Tumblr: Dinocanid
Deviantart: HOAFan
Contact:

Re: What's wrong in my code?

#2 Post by Dinocanid »

The code has incorrect indentation, it should be sort of like this:

Code: Select all

menu:
    "Sai Daqui rapá, sou homem!":
        jump anger1

    "Tudo bem, mas o que aconteceu?":
        jump romantic1

label anger1:
    show steve waifu sad
    s "Desculpa!"
    hide steve waifu sad
    "-10 de amizade com Steve (Waifu)"
    "-15 de amor com Steve (Waifu)"
    scene bg city-street1
    with Dissolve(.5)

    pause .5

    scene chc_stop1
    with Dissolve(.5)

label romantic1:
    show steve waifu normal
    s "Sério? Senpai... você brigou com uns caras e ai caiu na rua..."
    You "ah muito obrigado, você é muito gentil"
    s "..."
    hide steve waifu normal
    scene cutscene1
    s "Senpai... você é tão..."
    s "Tchau!"
    scene cutscene1
    with Dissolve(.5)

    pause .5

    scene chc_stop1
    with Dissolve(.5)
    "+3 de Amizade com Steve (Waifu)"
    "+1 de Amor com Steve (Waifu)"
    you "o que eu deveria fazer agora?"

return
(Haven't tested it, but that should be it)

Are you using one of the suggested code editors like Atom or Editra? If not, I would recommend it to avoid indentation issues.

User avatar
MiniDarkOF
Newbie
Posts: 4
Joined: Sun Oct 21, 2018 5:26 pm
Organization: UniversoRandom Studio & E.M Studio
IRC Nick: MiniDarkOF
Location: São Paulo, Brazil
Contact:

Re: What's wrong in my code?

#3 Post by MiniDarkOF »

Problems in Choice Options and Menus:

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 70: menu statement expects a non-empty block.
    menu > :
        
File "game/script.rpy", line 71: expected statement.
    "Sai Daqui rapá, sou homem!" > :
                
File "game/script.rpy", line 74: expected statement.
    "Tudo bem, mas o que aconteceu?" > :

Ren'Py Version: Ren'Py 7.1.1.929
Sun Oct 21 23:02:59 2018
I'm using Atom
i'm know how to create games in unity, but in ren'py it's my first time, i don't know what's is wrong
if remove ":" in "menu" and in the choices = error
if i put ":" in "menu" and in the choices = error
Emanuel Messias, R.d.S - A.K.A MiniDarkOF
São Paulo, Brasil

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3785
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: What's wrong in my code?

#4 Post by Imperf3kt »

Dinocanid wrote: Sun Oct 21, 2018 6:14 pm The code has incorrect indentation, it should be sort of like this:

Code: Select all

menu:
    "Sai Daqui rapá, sou homem!":
        jump anger1

    "Tudo bem, mas o que aconteceu?":
        jump romantic1

label anger1:
    show steve waifu sad
    s "Desculpa!"
    hide steve waifu sad
    "-10 de amizade com Steve (Waifu)"
    "-15 de amor com Steve (Waifu)"
    scene bg city-street1
    with Dissolve(.5)

    pause .5

    scene chc_stop1
    with Dissolve(.5)

label romantic1:
    show steve waifu normal
    s "Sério? Senpai... você brigou com uns caras e ai caiu na rua..."
    You "ah muito obrigado, você é muito gentil"
    s "..."
    hide steve waifu normal
    scene cutscene1
    s "Senpai... você é tão..."
    s "Tchau!"
    scene cutscene1
    with Dissolve(.5)

    pause .5

    scene chc_stop1
    with Dissolve(.5)
    "+3 de Amizade com Steve (Waifu)"
    "+1 de Amor com Steve (Waifu)"
    you "o que eu deveria fazer agora?"

return
(Haven't tested it, but that should be it)

Are you using one of the suggested code editors like Atom or Editra? If not, I would recommend it to avoid indentation issues.
This is still indented incorrectly, the first menu and all options need another four spaces in front of each, and a label before them.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
MiniDarkOF
Newbie
Posts: 4
Joined: Sun Oct 21, 2018 5:26 pm
Organization: UniversoRandom Studio & E.M Studio
IRC Nick: MiniDarkOF
Location: São Paulo, Brazil
Contact:

Re: What's wrong in my code?

#5 Post by MiniDarkOF »

Imperf3kt wrote: Sun Oct 21, 2018 10:19 pm
Dinocanid wrote: Sun Oct 21, 2018 6:14 pm The code has incorrect indentation, it should be sort of like this:

Code: Select all

menu:
    "Sai Daqui rapá, sou homem!":
        jump anger1

    "Tudo bem, mas o que aconteceu?":
        jump romantic1

label anger1:
    show steve waifu sad
    s "Desculpa!"
    hide steve waifu sad
    "-10 de amizade com Steve (Waifu)"
    "-15 de amor com Steve (Waifu)"
    scene bg city-street1
    with Dissolve(.5)

    pause .5

    scene chc_stop1
    with Dissolve(.5)

label romantic1:
    show steve waifu normal
    s "Sério? Senpai... você brigou com uns caras e ai caiu na rua..."
    You "ah muito obrigado, você é muito gentil"
    s "..."
    hide steve waifu normal
    scene cutscene1
    s "Senpai... você é tão..."
    s "Tchau!"
    scene cutscene1
    with Dissolve(.5)

    pause .5

    scene chc_stop1
    with Dissolve(.5)
    "+3 de Amizade com Steve (Waifu)"
    "+1 de Amor com Steve (Waifu)"
    you "o que eu deveria fazer agora?"

return
(Haven't tested it, but that should be it)

Are you using one of the suggested code editors like Atom or Editra? If not, I would recommend it to avoid indentation issues.
This is still indented incorrectly, the first menu and all options need another four spaces in front of each, and a label before them.
Can you give me short a example, please?
i don't understand
Emanuel Messias, R.d.S - A.K.A MiniDarkOF
São Paulo, Brasil

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3785
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: What's wrong in my code?

#6 Post by Imperf3kt »

Take all of the lines before label anger1, and add four spacebar presses to the start of them, ensuring that somewhere before the word "menu", you have "label something:" all the way to the left.

Correct

Code: Select all

label something:
    menu:
        "Do you speak Spanish?"
        
        "no hablo español":
            jump somewhere
        "sí":
            jump somewhere_else

Incorrect

Code: Select all

menu:
    "Do you speak Spanish?"
        
    "no hablo español":
        jump somewhere
    "sí":
        jump somewhere_else
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
MiniDarkOF
Newbie
Posts: 4
Joined: Sun Oct 21, 2018 5:26 pm
Organization: UniversoRandom Studio & E.M Studio
IRC Nick: MiniDarkOF
Location: São Paulo, Brazil
Contact:

Re: What's wrong in my code?

#7 Post by MiniDarkOF »

Very Thanks!

P.S: if you think i speak spanish, you are wrong.
I'm brazilian, we speak brazilian portuguese, but i appreciate your try to create a tutorial with my
"supposed native language" great idea, you are a nice person
Emanuel Messias, R.d.S - A.K.A MiniDarkOF
São Paulo, Brasil

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3785
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: What's wrong in my code?

#8 Post by Imperf3kt »

I didn't think that was Spanish 🤔
Glad you got it working now and I could be of help.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot]