In need of Ren'py help!

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
Dylan_Bain
Regular
Posts: 101
Joined: Mon Mar 09, 2015 2:05 pm
Organization: Dylan Bain Games
Location: Scotland
Contact:

In need of Ren'py help!

#1 Post by Dylan_Bain »

Just got an error message on my test game saying

"if statement expects a non-empty block."

What does this mean?
The entire statement is

"if statement expects a non-empty block.
if question1 == True and question2 == True and question3 == True: <-"

How do you fix this?

Thanks!
Image
http://lemmasoft.renai.us/forums/viewto ... 52#p365552 Curently NOT Accepting Commisions!

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: In need of Ren'py help!

#2 Post by trooper6 »

Could you post your actual code, and put it in between code tags in order to preserve indentation.
Code tags are [ code], and [ /code]...but without the space right after the square bracket.

Post as much code as possible, including the lines after the if statement.
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

User avatar
Dylan_Bain
Regular
Posts: 101
Joined: Mon Mar 09, 2015 2:05 pm
Organization: Dylan Bain Games
Location: Scotland
Contact:

Re: In need of Ren'py help!

#3 Post by Dylan_Bain »

trooper6 wrote:Could you post your actual code, and put it in between code tags in order to preserve indentation.
Code tags are [ code], and [ /code]...but without the space right after the square bracket.

Post as much code as possible, including the lines after the if statement.
Yeah, of course!
Just in case you are wondering, I am just getting to know Ren'Py so I am making The Question bigger.

Code: Select all

   "Before I could ask her my question, I had to get to know a bit more about her."
    "She turned to me and smiled."
    m "Hey, so..."
    
    label menu1: 
    
    if question 1 == True and question2 == True and question3 == True:
    $ all_questions_over = True
    
    menu:

        "What is your name?" if question1 == False:
            jump question1
            
        "How old are you?" if question2 == False:
            jump question2
            
        "Where are you from?" if question3 == False:
            jump question3 
            
        "End conversation." if all_questions_over == True:
            jump afterquestions
After that there is basically labels for each answer, each ending with 'question[number] = True' so they will no longer appear in the question list.
Image
http://lemmasoft.renai.us/forums/viewto ... 52#p365552 Curently NOT Accepting Commisions!

User avatar
Riverbird
Newbie
Posts: 21
Joined: Wed Feb 11, 2015 2:41 pm
Deviantart: RiverbirdAlpha
Contact:

Re: In need of Ren'py help!

#4 Post by Riverbird »

You need to indent the line:
$ all_questions_over = True

Basically, the indentations are key in Python (and Ren'py.) The "if" statement will run the next "block" of code, and those blocks are defined by being indented.

So:

Code: Select all

if Bob == "Happy":
    $ call Happy_Dance
    $ call Next_Bob
Would call both Happy_Dance and Next_Bob with the same "if" statement.

If there is no indented block found after the statement, then it will panic since it knows there should be something there to run, and give the error you just saw.

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: In need of Ren'py help!

#5 Post by trooper6 »

The problem with your code is indentation...well and other things.
Every time you have a colon, you need to indent the next line that belongs to that block and then indent back out when you are finished with that block. Also you have "jump question 1" in your menu...but I don't see any question1 defined anywhere. I don't think you even need to jump to a different label if the conversation that happens after the question isn't all that lengthy.

And you get a bit complicated in a way that you don't really need.

Something that is useful for you: you can label your menu. So here is how I would rewrite the code you provided:

Code: Select all

label start:
    #I always define all my variables at the beginning of the start label, since none of the questions have been asked yet, you start your variables as Fals
    $question1_asked = False
    $question2_asked = False
    $question3_asked = False
    
    #Presumably you have some talking happening here until you get to...

    "Before I could ask her my question, I had to get to know a bit more about her."
    "She turned to me and smiled."
    m "Hey, so..."
    
    menu opening_questions: 
        "What is your name?" if question1_asked == False:
            s "My name is Sylvie...what's yours?"
            m "My name is Dylan."
            $ question1_asked = True
            jump opening_questions
        "How old are you?" if question2_asked == False:
            s "I'm 20...my birthday is next week, though!"
            m "Really? Are you doing anything special?"
            s "I'm having a party over at the Watering Hole at 8...you are welcome to come along!"
            $ question2_asked = True
            jump opening_questions
        "Where are you from?" if question3_asked == False:
            s "I'm from Seattle. I just moved here. Is this your hometown?"
            m "I was born and raised here!"
            s "I'd love it if you gave me a tour of the sights one of these day."
            m "It would be my pleasure!"
            $ question3_asked = True
            jump opening_questions  
        "End conversation." if all([question1_asked, question2_asked, question3_asked]):
            jump afterquestions

label afterquestions:
    "It was nice getting to know Sylvie."
    #Blah, blah, blah

    return
Look over the code ask ask if there is something that isn't clear!
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

User avatar
Dylan_Bain
Regular
Posts: 101
Joined: Mon Mar 09, 2015 2:05 pm
Organization: Dylan Bain Games
Location: Scotland
Contact:

Re: In need of Ren'py help!

#6 Post by Dylan_Bain »

trooper6 wrote:The problem with your code is indentation...well and other things.
Every time you have a colon, you need to indent the next line that belongs to that block and then indent back out when you are finished with that block. Also you have "jump question 1" in your menu...but I don't see any question1 defined anywhere. I don't think you even need to jump to a different label if the conversation that happens after the question isn't all that lengthy.

And you get a bit complicated in a way that you don't really need.
Thanks for the help!
Because I didn't give the full page of code, some things I had to change in order for it to work, but thanks for the help anyway!

Dylan_Bain
Image
http://lemmasoft.renai.us/forums/viewto ... 52#p365552 Curently NOT Accepting Commisions!

Ak-Sai
Newbie
Posts: 4
Joined: Tue Apr 17, 2012 12:48 am
Contact:

Re: In need of Ren'py help!

#7 Post by Ak-Sai »

Hello to everyone.

I order to avoid spawning additional topics I would post my question here, I hope it woild be OK.

I'm trying to make a VN/sanbox style game and got stuck when I was trying to add a drawer in PC room where he/she would be able to see what kind of items he/she has.

I wish to display it as a list, but I keep getting "expected a keyword argument or child statement" error.

Code itself

Code: Select all

    screen drawer():
        frame:
            align (1.0, 0.0)
            has vbox
            if plain_cloth_own = 1 and cloth_worn != "plain clothes":
                "A set of casual clothes"
            if fancy_cloth_own = 1 and cloth_worn != "fancy clothes":
                "A set of exquisite dress"
            if univ_cloth_own = 1 and cloth_worn != "university uniform":
                "A set of uniform from my university"
So - what am I doing wrong?

Thanks in advance.

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: In need of Ren'py help!

#8 Post by trooper6 »

= is to assign a value,
== is to check equivalencies

So your if should be: if plain_cloth_own == 1
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

Ak-Sai
Newbie
Posts: 4
Joined: Tue Apr 17, 2012 12:48 am
Contact:

Re: In need of Ren'py help!

#9 Post by Ak-Sai »

trooper6 wrote:= is to assign a value,
== is to check equivalencies

So your if should be: if plain_cloth_own == 1
I've tried to modify code that way, but I keep receiving same error message. Maybe there are problems with that I try to put it as vbox stuff, or identation... or something. )

What exactly that kind of "expected a keyword argument or child statement" error supposed to mean?

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: In need of Ren'py help!

#10 Post by xavimat »

Please read some documentation and see some examples before trying to do screens. :)
Your lines with text don't have any screen statement. Ren'Py doesn't know what to do with "A set of casual clothes"
You probably want a text printed in the screen, then you need the "text" statement:

Code: Select all

text "A set of casual clothes"
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Ak-Sai
Newbie
Posts: 4
Joined: Tue Apr 17, 2012 12:48 am
Contact:

Re: In need of Ren'py help!

#11 Post by Ak-Sai »

Thank you very much, it helped.

Post Reply

Who is online

Users browsing this forum: NerdyBitch