"Non-empty block?" Buwah?

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
Lime

"Non-empty block?" Buwah?

#1 Post by Lime »

First of all, I would like to thank all of you for being so patient with me. I know I must be tiring you guys out by asking all of these questions. XD;

Anyway, I would like to know what a "non-empty block" is. I've been wondering what it is after I keep seeing error messages that say something "expects a non-empty block", but since neither the demo nor the Wiki mention this phrase at all, I'm left confused. Could someone possibly help me out with this?

I'd also like to learn what I'm doing wrong in the first place to avoid getting more errors with this annoying message in the future, though I think I may already know the answer. You see, I'm trying to make it so that my game remembers if I picked a certain choice when I click on the choice that leads to that choice. (Redundancy is redundant.) However, the code that makes the game remember which of the two choices I chose is after where I put the codes that makes the game show a certain text depending on what the choice was. Is that what I'm doing wrong? If you need more details on this, please let me know.

Again, thanks in advance!

JQuartz
Eileen-Class Veteran
Posts: 1265
Joined: Fri Aug 31, 2007 7:02 am
Projects: 0 completed game. Still haven't made any meaningfully completed games...
Contact:

Re: "Non-empty block?" Buwah?

#2 Post by JQuartz »

Lime wrote: I would like to know what a "non-empty block" is
A block that has at least one statement in it. What's a block? Read it here:
http://www.renpy.org/wiki/renpy/doc/ref ... 6bb62092ec

Generally this error message is caused by errors in indentation.
Lime wrote: You see, I'm trying to make it so that my game remembers if I picked a certain choice when I click on the choice that leads to that choice. (Redundancy is redundant.) However, the code that makes the game remember which of the two choices I chose is after where I put the codes that makes the game show a certain text depending on what the choice was. Is that what I'm doing wrong? If you need more details on this, please let me know.


Huh? Me no understand what you say. But like I said the problem is likely caused by the indentation of the block (probably after the menu), I think.
Last edited by JQuartz on Sun Nov 18, 2007 8:30 pm, edited 1 time in total.
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: "Non-empty block?" Buwah?

#3 Post by PyTom »

Basically, a block consists of lines of code that are all at the same indentation, and that are indented relative to a previous line of code. For example, if we have:

Code: Select all

Line A
    Line B
    Line C
Line D
Lines B and C form a block, and that block should be expected by line A.

Ren'Py has a bunch of statements that require a block. For example, if you have a bunch of menu choices, but don't indent the code after them correctly, you'll get an error. This is incorrect:

Code: Select all

menu:
    "Choice 1":
    "I get put into jail."
    "Choice 2":
    "I get fired. Out of a cannon. Into the sun."
This is incorrect because the two menu choices each expect a block. The correct code will indent the say statements properly, giving each choice a block.

Code: Select all

menu:
    "Choice 1":
        "I get put into jail."
    "Choice 2":
        "I get fired. Out of a cannon. Into the sun."
Hopefully, this helps a bit. If you're still confused, it may make sense to post the lines of code surrounding the line with the error (enclosed in code tags), so we can more accurately diagnose your problem.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Post Reply

Who is online

Users browsing this forum: Ocelot, piinkpuddiin, snotwurm