Chapter 6: Descriptions
I’m interested in reading this chapter because I’m not sure what’s different between Texts in general and Descriptions specifically, and why they need different chapters.
6.1 is What are descriptions.
Oh, I see; a description is a combination of adjectives and/or nouns. Not text at all!
So we’re not talking about ‘the description of the zorkmid is “----”’, we’re talking about:
The cargo trunk is an openable container.
Here ‘openable container’ is a description.
You can make lists of things matching a description:
"You look down at [the list of things in the basket]."
And count them:
"There are [number of things in the basket] things in the basket."
Now I can definitely see why this would use its own chapter, I had trouble with this recently.
Section 6.2 is Adjectives and nouns.
It says descriptions have at most one noun and any number of adjectives:
supporter = the noun supporter
closed = the adjective closed
the open wine cask = the adjective open + the noun wine cask
something portable = (some) + the noun thing + the adjective portable
It mentions that ‘something’ is ‘some thing’, referring to the kind ‘thing’.
[T]here are eight special nouns of this kind, but with only three different meanings between them:
something = anything someone = anyone = somebody = anybody somewhere = anywhere
So for instance “anybody male” or “somewhere dark” are valid descriptions.
I’d assume that ‘anybody male’ only matches people and not animals and ‘somewhere dark’ only matches rooms and not regions or containers, but it doesn’t say.
These special words can go before adjectives, while all other nouns come after.
No examples yet!
Section 6.3 is Sources of Adjectives.
The ones we already have are either/or properties and kinds of values. There are also new adjectives you can create and reserved ones like ‘visible’, ‘touchable’, and ‘adjacent’.
Section 5.4 is Defining New Adjectives. I’m interested in seeing this because I’ve only defined adjectives through either/or properties or kinds of values before, and only learned the second one in the last month.
Oh! We use the phrase ‘definition’! I see this in Emily Short’s code all the time. Man, that’s so useful! It seems like a nice way to make an either/or property that updates itself.
Here’s an example:
Definition: A supporter is occupied if something is on it.
Note the colon, which is essential, and the usage of “it” in the definition part to refer to the object in question.
You can ‘overload’ this definition in the programming sense:
We could give a second definition thus:
Definition: A room is occupied if a person is in it.
These are entirely different senses of the word “occupied” - a mantelpiece is occupied if an invitation is on it, but for a drawing room to be occupied there must be human presence - and Inform applies whichever sense is relevant when deciding whether or not a given object is “occupied”.
If you want it to have an opposite you specify that:
Definition: A room is occupied rather than unoccupied if a person is in it.
So this really seems like either/or properties in a fancy hat, with the main difference I’m seeing is that Inform stores either/or properties and they have to be manually changed but these are evaluated when-needed and thus allow more flexible changes? (Maybe???)
My hypothesis above is supported by the following example:
Inform could not satisfy:
The Ballroom is occupied. The bucket is a large container.
because there is not enough information: by whom is the Ballroom occupied? How large, exactly?
My only concern is that so far we’ve only seen definitions that fit on one line, while I can think of several uses that would require multi-line logic. You could get around that with nesting things (like Definition: a thing is hot if… and Definition: A thing is aflame if it is hot and…)
It is occasionally clumsy having to refer to the subject of a definition using “it”. We can avoid this and give the definition better legibility by supplying a name instead. For instance:
Definition: a direction (called thataway) is viable if the room thataway from the location is a room.
Example 73 is Finishing School.
Definition: a person is another if it is not the player.
Instead of eating something in the presence of another person:
say "Your mannerly upbringing prevents you from eating without a fork or knife in front of someone."
Section 6.5 is adjectives for values. I already know one reason this section is very useful: it’s hard to make lists of things based on their numerical values, but lists based on adjectives are very easy to construct. I was not aware of this section before but will definitely use it in the future!
Here are some examples:
Definition: A number is round if the remainder after dividing it by 10 is 0.
Definition: A time is late rather than early if it is at least 8 PM.
There are some built-in definitions:
positive - one which is greater than zero (but not 0 itself)
negative - one which is less than zero (but not 0 itself)
even - a number like ..., -4, -2, 0, 2, 4, ...
odd - a number like ..., -5, -3, -1, 1, 3, 5, ...
empty - the text "", with no characters in it, not even spaces
non-empty - any text which does have at least one character in
The same adjective can be reused in other areas as long as they don’t conflict:
A container can be odd or ordinary.
doesn’t contradict that numbers can be odd or even.
You can also restrict definitions to a single thing:
A colour is a kind of value. The colours are red, green and blue.
Definition: red is subtle if the player is female.
Definition: a colour is subtle if it is blue.
and this example also illustrates some hierarchy:
The first definition of “subtle” takes precedence, of course, since it has the more specific domain - it applies only to red. The effect of this is that, if the player’s female, the subtle colours are red and blue; if not, just blue.
Example 74, Only You, uses even and odd numbers:
Every turn when the turn count is even:
if every room is smoky, make no decision;
let previously smoky be whether or not the location is smoky;
repeat with area running through smoky rooms:
now every room which is adjacent to the area is smoky;
if previously smoky is false and the location is smoky:
say "[The location] is filling rapidly with smoke."
Section 6.6, Whereabouts on a scale? is about using inequalities in definitions:
Definition: A container is huge if its carrying capacity is 20 or more.
Definition: A container is large if its carrying capacity is 10 or more.
Definition: A container is standard if its carrying capacity is 7.
Definition: A container is small if its carrying capacity is 5 or less.
In my stats class, if you have a range of values and an object in that range you approximate its true value with the midpoint. But inform uses the smallest value, so with the above definition, if we type:
The basket is a large container in the Shop. The thimble is a small container in the Shop. The matchbox is a standard container in the Shop.
You can use different categories for different kinds, and creating a thing with that category will use the definition for the kind it belongs to:
A person has a number called height. Definition: A man is tall if his height is 72 or more. Definition: A woman is tall if her height is 68 or more.
Inform then judges whether someone is or is not “tall” using different standards for men and for women, and
In the Shop are a tall man and a tall woman.
then they will have the most moderate values they can have, that is, the basket will have carrying capacity 10 and the thimble 5 (and of course the matchbox 7).
Section 6.7 is Comparitives. Apparently if you have a numerical definition of an adjective based on an inequality, you can turn that adjective into a comparator:
If we define
Definition: A container is large if its carrying capacity is 10 or more.
we not only say how to test if something is large (see if its capacity is at least 10) and how to create something large (give it a capacity of exactly 10), we also create a new form of comparison. Thus,
if the basket is larger than the thimble ... if the thimble is not larger than the basket ...
are both true.
Have any of you used this before? It’s interesting but seems risky…
It also mentions that you can use the following comparisons with the ‘taller’ definition from earlier:
if Adam is taller than Eve ...
if Adam is the same height as Eve ...
if Adam is shorter than Eve ..
But this is weird because we defined ‘tall’ differently for men and women. So is making the comparative form of a defined adjective really just about looking at what values it has inequalities of and comparing those values? If so that should probably be stated.
Section 6.8 is Superlatives. It’s exactly like the last section but we use ‘largest’ or ‘smallest’. It also explains the etymological process:
Note that Inform constructs comparatives and superlatives by a pretty simplistic system. If we want to use these forms for an adjective expressing the relatively large size of a room, we had better go with “roomy” (roomier, roomiest) - not “spacious” (spaciouser, spaciousest).
I’ve never used the comparative forms before but now I want to try.
Section 6.9 is Which and Who.
It says that you can make descriptions of things (again when making lists or doing for loops or random things) that include relationships by using ‘who’ or ‘which’ which are equivalent:
an open container which is on the table
a woman who is inside a lighted room
an animal which is carried by a man
a woman who is taller than Mark
something which is worn by somebody
You can also omit ‘who’ or ‘which’ in the above phrases. But sometimes you need to spell it out:
a man who is not Sherlock Holmes
And you can nest things:
something worn by a woman who is in a dark room
Section 6.10: Existence and there
This section is for where you want to create something but not give it a location. You can just say ‘there is a…’:
There is a man called Bond.
You can also just do this with ‘Bond is a man’. (At least I think there isn’t a difference).
You can use if there is a woman in the Summerhouse, ...
in conditions. This is better than what I usually do, which is if the number of women in summerhouse > 0:
And you can check for non-existence:
if there is nobody in the Summerhouse, ...
Section 6.11 is ‘a word about in’.
This section says that ‘in’ means a couple of things. First, containment:
The croquet ball is in the box.
He goes on to say:
This kind of “in” talks only about direct containment. If we ask [assuming the box is in Summerhouse, which I cut out earlier]
if the croquet ball is in the Summerhouse, ...
then the answer is that it isn’t - it is in the box which is itself in the Summerhouse, but that’s not the same thing.
This is almost always the meaning of “in” that we intend.
Hmm, I disagree with that last statement. I usually DO want ‘in’ to mean indirect containment. If I have a book in a chest in the Summerhouse, I darn well want to the game to think the book is in the summerhouse in IF conditions!
I know from a programming viewpoint that it makes way more sense to have ‘in’ be unambiguous, but I wouldn’t say that excluding indirect containment from ‘in’ is a logical action.
There have been numerous threads from confused people over the years. One example is here:
The second thing Inform means by ‘in’ is ‘in’ regions.
The answer is that meaning 1 is always the meaning of “X is in Y” unless Y is explicitly the name of a region. Thus:
if the croquet box is in the Garden Area, ...
is meaning 2, because “Garden Area” is the name of a region.
This is nice (and I could honestly see myself making some rooms their own region just so I don’t have to deal with indirect containment; but probably not, since I can use ‘enclosed by’).
There then is a caveat to this that I don’t understand (if helpful people want to comment here please do:)
[v]alues are indeed sometimes given names (becoming “variables”, or values “that vary”). Suppose “mystery value” is a name for a value which is an object, but which has different identities at different times. Then Inform reads
if the croquet box is in the mystery value, …
as meaning 1, because whatever “mystery value” is, it isn’t explicitly a region name, even if from time to time it might happen to be equal to a region.
This sounds like he’s talking about a value which is an object but can also become a region? Is that even a thing? Can the same variable sometime be a thing and sometimes be a region? Seems fake to me, but if anyone cane explain, please do.
If we are in such a confusing situation, we can say:
if the croquet box is regionally in the mystery value, ...
Section 6.12 is A word about nothing.
This also has two meaning. Meaning 1 is ‘no thing’:
Definition: a container is bare if nothing is in it.
Meaning 2 is ‘nothing’ as a value. I know if you make a list of things with a description and nothing matches that description, then it will return ‘nothing’, so you can check for that:
Definition: a container is impossible if its matching key is nothing.
Meaning 2 is used only for the keyword ‘is’ with no other relationships, and meaning 1 is for all others, like ‘is in’.
Section 6.13: To be able to see and touch
Oh! I’ve always heard about this section! The infamous ‘visible!’ >:)
Two of the adjectives built into Inform are:
"visible" - the player can see this "touchable" - the player can touch this
So we can write descriptions such as “someone visible” or “a touchable container”. We also have adjectives “invisible” and “untouchable”, as might be expected. The visibility adjectives are particularly useful because the following is likely to go wrong:
if Helen is in a dark room, ...
This tests whether the room is dark, of itself; Helen may in fact be able to see by means of a torch, but the room is still “dark”.
A chunk of this section seems to be missing It says:
We can also talk about what other people can see and touch:
something which can be seen by Helen
are synonymous.
What are synonymous? I only see one example…
It gives the Inform definition of invisible:
Definition: Something is invisible if the player cannot see it.
It goes on to say:
The exact definitions of visibility and touchability are complicated, because there are so many ways in which vision and touch can be obstructed, but the gist is that they behave as one would expect.
Note that in darkness, nothing is visible, and that nobody can see from one room to another.
Hmm, so I’m going to make a guess. It seems to me that visible means ‘not in darkness or an opaque container’, and invisible means everything else. It doesn’t seem to mean ‘visible from where I am’. Let’s experiment with a sandbox program:
Lab room is a room.
Closet is south of lab room. Closet is a dark room.
Lobby is north from lab room.
The glass case is a closed transparent unopenable container in lab room. The bouncy ball is in the glass case.
The chest is a closed opaque openable container in lab room. The gold piece is in the chest.
The baseball bat is in Closet.
The hamburger is in Lab room.
The receipt is in Lobby.
When play begins:
repeat with current running through things:
say "[The current] [are] [if current is visible]visible[otherwise]invisible[end if]."
When I run this, I get:
You are visible.
The glass case is visible.
The bouncy ball is visible.
The chest is visible.
The gold piece is invisible.
The hamburger is visible.
The baseball bat is invisible.
The receipt is invisible.
Oh, so it does care about which room it’s in, because the receipt is invisible!
Okay, that explains the thing he says about not seeing into other rooms.
Let’s try touchable:
You are touchable.
The glass case is touchable.
The bouncy ball is untouchable.
The chest is touchable.
The gold piece is untouchable.
The hamburger is touchable.
The baseball bat is untouchable.
The receipt is untouchable.
Hmm, this is very reasonable. Only the thing in the glass case changed.
The problem must be with action definitions, then, since that’s when I usually see people have problems. Defining an action as applying to ‘one visible thing’ usually seems to cause problems. I guess we’ll find out why later!
Example 76 is Lean and Hungry:
Every turn:
if the sinister gentleman can touch something valuable (called the treasure) which is not carried by a person:
try the gentleman taking the treasure.
Report the gentleman taking something:
say "[The gentleman] slyly acquires [the noun] and tucks it into his pocket." instead.
Neat!
Section 6.14 is complicated: Adjacent rooms and routes through the map.
Adjacency is easy:
Two rooms are said to be adjacent if there is a map connection between them which does not pass through some barrier such as a door. This is easily tested:
if the Hallway is adjacent to the Study ...
We can use ‘adjacent’ as an adjective:
if somebody is in an adjacent room, ...
You can ask for more specific map connections as so (if a door is in between, the connection maps to the door, not the room on the other side):
if the Ballroom is mapped north of the Hallway, ...
You can get the room on the other side of a door (or just the next room if there is a door) with:
room (direction) from /of (room) … room
if the room north from the Garden is nothing, say "The grass leads nowhere."
If there is a door, you can say:
door (direction) from /of (room) … door
and if you don’t know, and want to catch a door if there is one or a room if there is not, you can say:
room-or-door (direction) from /of (room) … object
Now for the hard part: pathfinding!
best route from (object) to (object) … object
This gives the next direction to go to get from one room to the next, and just the next direction. It does not go through doors unless you specify it to do so:
The description of the brass compass is "The dial points quiveringly to [best route from the location to the Lodestone Room, using even locked doors]."
You can also restrict it to rooms that match a specific description:
best route from the Drawbridge to the Keep through visited rooms
(the condition you give also applies to the endpoints).
You can also count the number of steps to move from one room to the next (with or without restrictions):
number of moves from (object) to (object) … number
This phrase produces the number of map connections which must be followed in order to get from A to B by the shortest number of movements between rooms. If A and B are the same, the answer is 0; if there is no route at all, the answer is -1.
There are two algorithms for route-finding.
Use fast route-finding
is quick but a memory hog. It is the default for Glulx.
Use slow route-finding
is slow but uses less memory. It is the default for Z-machine.
Now we have 5 examples all at once!
Example 77 is Mistress of animals:
Every turn:
if Artemis is in a room (called the current space):
let next space be a random room which is adjacent to the current space;
if Artemis is visible, say "Artemis heads to [the next space].";
move Artemis to next space;
if Artemis is visible, say "Artemis arrives from [the current space]."
Section 78 is All Roads Lead to Mars, which makes the map rearrange itself so the player always goes the right place next. This actually happens in the Mars section of Photopia, so I wonder if this is from Adam Cadre’s code, a later recreation, or neither.
Before going a direction (called way) when a room (called next location) is not visited:
let further place be the room the way from the location;
if further place is a room, continue the action;
change the way exit of the location to the next location;
let reverse be the opposite of the way;
change the reverse exit of the next location to the location.
Example 79 is Hotel Stechelberg
After looking:
say "Yellow arms on the signpost point:-[line break]";
repeat with destination running through interesting rooms:
let the way be the best route from the location to the destination;
if the way is a direction, say " [way] for [the destination]: [number of moves from the location to the destination] Std."
Example 80 is A View of Green Hills
This example lets players look into nearby rooms.
Understand “look [direction]” as facing.
Facing is an action applying to one visible thing.
Carry out facing:
let the viewed item be the room noun from the location;
if the viewed item is not a room, say "You can't see anything promising that way." instead;
try looking toward the viewed item.
and
Instead of facing up:
say "Above you is bright sky."
Understand "look toward [any adjacent room]" as looking toward. Understand "examine [any adjacent room]" as looking toward.
Looking toward is an action applying to one visible thing.
Carry out looking toward:
say "You make out [the noun] that way."
Example 81 is Unblinking, where travelling only through lit areas. It uses a fake invisible object called the ‘light-meter’ whose only purpose is to be a player surrogate that checks if things are visible in that room.
This reminds me of the person I tutored in Inform 7 for money who wanted to make a complex elevator. We ended up making an invisible NPC called the elevator pusher who would teleport into the elevator and push buttons from the inside whenever you pushed buttons from the outside.
This example gives a caution:
An important word of caution: this method would give false negatives if there were a backdrop lightsource, such as the moon, providing light to the Upward Path. This is because backdrops are actually moved around the map by Inform during play, following the player around. So if the moon backdrop is in the Crash Site with the player, it will not be in the Upward Path as well – even if it’s scheduled to move there as soon as the player does.
Section 6.14 is all, each, and every. I use these sometimes for assertions, but not for if statements.
if each door is open
if anyone is carrying all of the animals
if everybody is in the Dining Room
We can also do:
if some of the doors are open
if most of the doors are open
if almost all of the doors are open
The thresholds for these are at least one being true, more than half being true, or at least 80% being true.
The four following things are equivalent:
if no door is open
if all of the doors are not open
if none of the doors is open
if all of the doors are closed
It can also do ‘all’ and ‘most’, etc. for values where only finitely many values are possible:
Colour is a kind of value. The colours are red, orange, yellow, green, blue, indigo and violet. A colour can be found or unfound.
if every colour is found
if most of the colours are found
if any colour is found
Example 82 is a rare 4-star example, including rulebooks and other things.
This is too long to quote here but here are some pertinent selections:
The complaint rules is a rulebook.
A complaint rule:
if something (called the offending item) on the table is drippy:
say "'Help! Get me a coaster!' screams the table[if the table is visible], its veneer squirming under [the offending item][otherwise] from the Dining Room[end if].";
rule succeeds;
if something (called the offending item) on the red chair is drippy:
say "'Oh dear,' murmurs the red chair, as [the offending item] drips into its velvety seat. 'Oh dear, I will have a damp spot. This is so very -- what will people think?'";
rule succeeds;
if something (called the offending item) on the visible armchair is drippy:
say "[The offending item] visibly begins degrading the suede where it sits. The armchair is tactfully silent.";
rule succeeds;
if a drippy thing (called the offending item) is in the location and the player is in the Dining Room:
say "'Cripes,' says the parquet. 'No one mind me at all. Just leave that [offending item] right here. You know I'm the most valuable thing in the room?'";
rule succeeds.
An every turn rule:
if some of the things are concerned, say "You sense some resentment from [the list of concerned things]."
An every turn rule:
now score is 5 minus the number of concerned things;
if the location is concerned, decrement the score;
if all of the supporters are concerned and the location is concerned, end the story;
if none of the supporters are concerned and the location is not concerned, end the story finally.
Section 6.16 Counting while comparing
You can put specific numbers of things in your if statements:
if two women are carrying animals
if at most three doors are open
if fewer than 10 portable containers are closed
if all but two of the devices are switched on
if there are more than six locked doors
Here ‘if two women are…’ is functionally equivalent to ‘if at least two women are…’
If you want to be precise, you can say something like ‘if exactly two women are…’
The “all but” counts - say, “if all but two doors are open” - are exact: if, in fact, all of the doors are open then this will be found false.
You can also use this for any other finite amount of values (so not all numbers or all texts):
if more than three scenes are happening
if there are more than two non-recurring scenes
And that’s it!
I always skipped this chapter because I thought it meant object descriptions of nouns. I guess a more apt name that I would give it (but is ugly) is ‘looking up objects by their properties’, since every time we use these descriptions we’re looking things up, except in the very rare case we are using them to declare something.