The "after opening a closed container" code block is still messing
up:
Where am I going wrong?
<code>
to say /l: say line break.
Starter is a room.
a closed openable container called a box is in Starter.
the box is fixed in place.
a ball, a bat, a wooden block, a steel rod, a plastic thingy,
and a paper boat are in the box.
definition: a container is empty if the number of things in it is 0.
after opening a closed container:
if the noun is empty begin;
say "[The noun] is empty.";
otherwise;
say "You have opened the [noun].[/l]Inside [the noun] you see the
following: [/l]";
repeat with item running through things inside the noun:
say "a [item][/l]";
end if.
instead of searching an open container:
say "Inside [the noun] you see the following: [/l]";
repeat with z running through things in the noun:
say "a [z][/l]";
<code>
...but you're using "begin;" syntax. The indentations are entirely
irrelevant.
> The "after opening a closed container" code block is still messing
> up:
>
> Where am I going wrong?
Well, for one thing, if you're using "repeat" in a block that includes
"begin;" you need to use "repeat begin;" and "end repeat". It took me a
couple of minutes to sort this out, because I always use
colon-and-indentation, but the following compiles:
after opening a closed container:
if the noun is empty begin;
say "[The noun] is empty.";
otherwise;
say "You have opened the [noun].[/l]Inside [the noun] you see the
following: [/l]";
repeat with item running through things inside the noun begin;
say "a [item][/l]";
end repeat;
end if.
instead of searching an open container:
say "Inside [the noun] you see the following: [/l]";
repeat with z running through things in the noun begin;
say "a [z][/l]";
end repeat.
--JA
...but you're using "begin;" syntax. The indentations are entirely
irrelevant.
> The "after opening a closed container" code block is still messing
> up:
>
> Where am I going wrong?
Well, for one thing, if you're using "repeat" in a block that includes
"begin;" you need to use "repeat begin;" and "end repeat". It took me a
couple of minutes to sort this out, because I always use
colon-and-indentation, but the following compiles:
after opening a closed container:
if the noun is empty begin;
say "[The noun] is empty.";
otherwise;
say "You have opened the [noun].[/l]Inside [the noun] you see the
following: [/l]";
repeat with item running through things inside the noun begin;
say "a [item][/l]";
end repeat;
end if.
instead of searching an open container:
say "Inside [the noun] you see the following: [/l]";
repeat with z running through things in the noun begin;
say "a [z][/l]";
end repeat.
--JA
>
> Well, for one thing, if you're using "repeat" in a block that includes
> "begin;" you need to use "repeat begin;" and "end repeat". It took me a
> couple of minutes to sort this out, because I always use
> colon-and-indentation, but the following compiles:
(SNIP)
Thanks much. Maybe the I7 Manual needs to be corrected in order to
reflect this.
It currently does NOT do that at this time. Correct me if need be.
The error message is pretty clear about it:
"Problem. The rule or phrase definition 'after opening a closed
container' seems to use both ways of grouping phrases together into
'if', 'repeat' and 'while' blocks at once. Inform allows two
alternative forms, but they cannot be mixed in the same definition.
One way is to end the 'if', 'repeat' or 'while' phrases with a
'begin', and then to match that with an 'end if' or similar.
('Otherwise' or 'otherwise if' clauses are phrases like any other, and
end with semicolons in this case.) You use this begin/end form here,
for instance - 'if the noun is empty begin' .
The other way is to end with a colon ':' and then indent the
subsequent phrases underneath, using tabs. (Note that any 'otherwise'
or 'otherwise if' clauses also have to end with colons in this case.)
You use this indented form here - 'repeat with item running through
things inside the noun' ."
vw