[size=150]premise[/size]
I have defined a kind called a center space.
There is a center space in every room.
I have defined a cart thing.
The drawbridge is a room.
[size=150]Problem[/size]
I am trying to put the cart inside the center space of the drawbridge. The program is not letting me.
exact error message
p.s. on a completely unrelated note, is it possible to center the text on this forum? I can’t seem to figure out how.
You’re trying to refer to “the center space” as a property, which it isn’t. For all Inform knows you might be able to pick up a center space and move it to a different room, so each room might not have exactly one center space within it at all times.
Well, I think you can’t do the “random center space” trick as an assertion, you’d have to do it as a when play begins rule. So “When play begins: now the cart is in a random center space in the drawbridge.”
If you write “The cart is in a random center space in the drawbridge” then the game will create a container called “a random center space in the drawbridge,” put it out of play, and put the cart in it! But on a test, the when play begins rule should work.
I think this only works when you’re creating something that’s part of something else. (Maybe a couple of other kinds of assembly, too.) So if you write “A nose is part of every person” then the nose that is part of Jane will be named Jane’s nose. But if you write “a center space is in every room” the center space that is in the drawbridge won’t be named “the drawbridge’s center space,” so the declaration “The cart is in the drawbridge’s center space” will create a new container (not a center space) called “the drawbridge’s center space,” out of play.
The best way I know to do this is to define objects through a relation, and then move them into place.
A chair is a kind of thing.
Chair-ownership relates one chair (called the furnishing) to one room.
The verb to chair-own (it chair-owns, they chair-own, it is chair-owned) implies the chair-ownership relation.
Every room is chair-owned by a chair.
When play begins:
repeat with R running through rooms:
let C be the furnishing of R;
now C is in R.
[To test this...]
Check examining a chair:
if the noun chair-owns a room (called R):
instead say "This chair belongs in [the R]."
Instead of jumping:
let C be the furnishing of the location;
say "The chair of [the location] is currently in [the holder of C]."
Here the chair-ownership relation is fixed through the game, so you can find the chair matching a room (or the room matching a chair) even if the player moves the object around.
Yes, it’s awkward that it’s “the furnishing of R” in one direction, but “if C chair-owns a room…” in the other direction. The compiler doesn’t provide a simple way to find the unique room for a chair, even though it’s genuinely a one-to-one relation.