I must be making a very amateur mistake in the first complicated object that I started to implement in the Hugo game which I recently began writing. I can’t see what I’m doing wrong.
First of all, here’s the entire object definition, with the text deleted. It’s supposed to be a bed that can be recessed into the wall in order to save space. When recessed, it’s considered “not open.”
object bed "..."
{
in startroom
is static
noun "...", "..."
adjective "..."
pronoun "..."
long_desc
{
"...bulk of description...";
if self is open print "..."; else print "...";
print " ... ";
if self is open print "... "; else print "... ";
print "... ";
if self is open print "...";
else print "...";
print "."
}
short_desc
{
"...first part of description... ";
if self is open
"...";
else
"...";
print "."
}
}
When I compile the above code, I get an error complaining of an illegal semicolon on the line containing the last “else print” statement in the long_desc:
if self is open print "..."; ! No period at end of sentence
else print "..."; ! No period at end of sentence
print "."
I can change these lines to get rid of the semicolons on the first two print statements and remove the last one by printing the period at the end of both of the other two statements instead of at the end of the code block by itself:
if self is open print "..." ! Period at end of sentence
else print "..." ! Period at end of sentence
This gives me a different error, “Undefined property,” at the last line of the object definition (containing only the closing brace), which is also the last line of the source file.
I tried enclosing all of the conditional statements in braces, but that didn’t work, either.
Thanks! I hope you all had a good Christmas yesterday.