I’m encountering some weird differences between the player and NPCs when trying to create a sort of factory pattern for generating patients that all share the basic anatomy but have different characteristics. What works for NPCs doesn’t for the player even though the player presumably is also a regular person. Or is it? Here’s simplified code:
Lab is a room. "Experiments happen here."
A body_part_state is a kind of value.
Body_part_states are initial, case.
Body_part_states are usually initial.
A body_part is a kind of thing.
A body_part has a table name called body_part_descriptions.
[To handle parts that come in twos like ears where we'd want to deal with one, the other, or both]
A bilateral_body_part is a kind of body_part.
A bilateral_body_part has a list of body_parts called subparts.
The ears are a kind of bilateral_body_part.
The ears is a part of every person.
The right_ear is a kind of body_part.
The printed name of right_ear is "right ear".
Understand "right ear" as right_ear.
A right_ear is part of every ears.
The left_ear is a kind of body_part.
The printed name of left_ear is "left ear".
Understand "left ear" as left_ear.
A left_ear is part of every ears.
Jill is a woman in the Lab.
The body_part_descriptions of Jill's right_ear is table of jills_right_ear_descriptions.
The body_part_descriptions of Jill's left_ear is table of jills_left_ear_descriptions.
table of jills_left_ear_descriptions
state txt
initial "pointed left"
case "even more pointed left"
table of jills_right_ear_descriptions
state txt
initial "pointed right"
case "even more pointed right"
The right_ear of player has a table name called body_part_descriptions. [won't compile without this]
The body_part_descriptions of right_ear of player is table of players_right_ear_descriptions.
The left_ear of player has a table name called body_part_descriptions. [won't compile without this]
The body_part_descriptions of left_ear of player is table of players_left_ear_descriptions.
table of players_right_ear_descriptions
state txt
initial "hairy"
case "hairier"
table of players_left_ear_descriptions
state txt
initial "ugly"
case "uglier"
So two strange problems:
Even though this successfully creates the ears->left/right ear hierarchy for both the player and Jill, only Jill’s tables of ear descriptions get assigned. Here’s the some output from the above code:
Lab
Experiments happen here.
You can see Jill here.
>showme Jill's right ear
right ear - right_ear
location: part of Jill's ears , which is part of Jill in Lab
singular-named, proper-named; unlit, inedible, portable
list grouping key: none
printed name: "right ear"
printed plural name: "right_ears"
indefinite article: none
description: none
initial appearance: none
body_part_descriptions: table of jills_right_ear_descriptions
>showme my right ear
right ear - right_ear
location: part of your ears , which is part of yourself in Lab
singular-named, proper-named; unlit, inedible, portable
list grouping key: none
printed name: "right ear"
printed plural name: "right_ears"
indefinite article: none
description: none
initial appearance: none
body_part_descriptions: (the empty table)
>
Why does the player’s right ear have only “the empty table” as its body_part_descriptions value? What is “the empty table” anyway?
And why will this code not even compile without the restatement of this?
The right_ear of player has a table name called body_part_descriptions.
The left_ear of player has a table name called body_part_descriptions.
The “Report on Translation: Failed” message is this:
Problem. You wrote ‘The body_part_descriptions of right_ear of player is table of players_right_ear_descriptions’ : but the property body_part_descriptions for the right_ear of player is not allowed to exist, because you haven’t said it is. What properties something can have depends on what kind of thing it is: see the Index for details.
See the manual: 3.7 > 3.7. Properties depend on kind
Problem. You wrote ‘The body_part_descriptions of left_ear of player is table of players_left_ear_descriptions’ : but the property body_part_descriptions for the left_ear of player is not allowed to exist.
Why does the
A body_part has a table name called body_part_descriptions.
not work for the player such that it must be repeated specifically for the player just to compile?
And even that repetition, why does the expected assignment of the table name not happen for the player when the exact same assignment statement does work for the NPC?
I’ve tried a workaround to limit the anatomy to NPCs – and not the player – but this sort of definition doesn’t help:
Definition: a thing is other if it is not the player.
The ears is a part of every other person.
since this won’t compile either. Seems I’m missing something pretty basic here.
Many thanks in advance for any pointers!