I am trying to print the contents of a room with new and old arrows. I thought the “printed name” would work, but it is ignored. Also, the SHOWME new or old arrows, I get the description of an old arrow, but it is labeled as a new arrow. What’s going on and why? Shouldn’t the printed name take care of it?
"ArrowRoom" by Clyde Falsoon
A weapon is a kind of thing. A weapon can be new or old.
Understand the old property as describing a weapon.
An arrow is a kind of weapon.
Description of an arrow is "[if arrow is new]A wooden shaft with fletching and a sharp tip.[else]A beat-up wooden shaft with ragged fletching and blunt tip.[end if].".
Printed name of arrow is "[if arrow is new]new arrow[else]old arrow".
The Supply Room is a room. "You are here, mostly among arrows.".
In the Supply room are 10 new arrows.
In the Supply room are 3 old arrows.
A gem is a thing. Description of gem is "A green shiny emerald, perhaps?".
A gem is in the Store.
"ArrowRoom" by Clyde Falsoon
A weapon is a kind of thing. A weapon can be new or old.
Understand the old property as describing a weapon.
An arrow is a kind of weapon.
Description of an arrow is "[if new]A wooden shaft with fletching and a sharp tip.[else]A beat-up wooden shaft with ragged fletching and blunt tip.[end if].".
Printed name of arrow is "[if new]new arrow[else]old arrow".
Rule for printing the plural name of an arrow:
say "[if new]new[else]old[end if] arrows"
The Supply Room is a room. "You are here, mostly among arrows.".
In the Supply room are 10 new arrows.
In the Supply room are 3 old arrows.
A gem is a thing. Description of gem is "A green shiny emerald, perhaps?".
A gem is in the Store.
As far as I can tell, the plural name is derived from the singular name upon the declaration of the kind or thing, i.e., when you say An arrow is a type of weapon. When you change the printed name of the arrow, the plural name has already been set.
The plural doesn’t require a rule. The code above illustrates two different methods to achieve the same effect. Often – but not always – the choice of which to use comes down to personal style. The methods above could have been reversed:
Rule for printing the name of an arrow:
say "[if new]new arrow[else]old arrow".
The printed plural name of an arrow is "[if new]new arrows[else]old arrows".
Personally, I generally prefer to do this sort of thing with “Before printing the name / plural name rules.” Like:
Before printing the name of an arrow (called it):
say "[if it is new]new [else]old ".
Before printing the plural name of an arrow (called it):
say "[if it is new]new [else]old ".
I want to generalize these descriptions at a higher level, so I have added this:
A weapon is a kind of thing. A weapon has an ownership.
Understand the ownership property as describing a weapon.
Ownership is a kind of value. The Ownerships are new, owned, and old.
Before printing the name of a weapon (called wpn):
if ownership of wpn is:
-- new: say "new [wpn]";
-- old: say "old [wpn]";
-- otherwise: say "[wpn]";
However, I get an error that says Problem. You wrote ‘Understand the ownership property as describing a weapon’ : but I don’t understand what property that refers to, but it doesn’t seem to be a property I know. An example of correct usage is ‘understand the transparent property as describing a container.’
I would really like to understand why this fails. Can anyone help?
OK, I found that the Ownership property has to be defined BEFORE (above in the code) it is used; i.e. “Ownership is a kind of value…”.
However, the wpn is always printed without the adjective. ALL arrows (for example) omit the old or new adjective. Perhaps just a problem with the switch-case?
It’s because plural name is handled separately from singular name. Try this:
Before printing the name of a weapon (called wpn):
if ownership of wpn is:
-- new: say "new ";
-- old: say "old ";
Before printing the plural name of a weapon (called wpn):
if ownership of wpn is:
-- new: say "new ";
-- old: say "old ";
The “name of a weapon” only refers to the name of a single weapon (“arrow”), so in the case of 10 arrows, Before printing the name of a weapon doesn’t get triggered at all. If it needs to print the name of a collection of arrows, it uses the default plural, which is just “arrows”.