Inform 7: Defined Value vs Printed Value

Let’s say a person has a descriptive value called height. A persons height may change during play, but the affect isn’t necessarily plot based; one particular event won’t change a person from short to tall, but a collection of events might. To that end every person also has a number value called height percentage, ranges of which correspond to height values.

A person can be gnomish, dwarfish, short, average height, tall, giant, or monumental (this is the height). A person is usually average height.
A person has a number called height percentage. The height percentage of a person is usually 500.

Definition: a person is gnomish if the height percentage of it is less than 1.
Definition: a person is dwarfish if the height percentage of it is less than 201.
Definition: a person is short if the height percentage of it is less than 401.
Definition: a person is average height if the height percentage of it is less than 601.
Definition: a person is tall if the height percentage of it is less than 801.
Definition: a person is giant if the height percentage of it is less than 1001.
Definition: a person is monumental if the height percentage of it is greater than 1000.

Inform 1.2 6.31/6G60 seems to understand this perfectly well internally, so I can write things like:

The description of the player is "As good looking as ever.[if short] You wouldn't mind being a little taller though.[else if tall] You wouldn't mind being a little shorter though.[end if]"

But if I try to say the height value, like:

The description of the player is "You're [height]!"

it never changes. It seems like Inform is keeping track of two different height values for a person: an inferred value based on the definitions that it seems to use nearly everywhere, and a specified value that it only seems to use when trying to say the height of a person. Is this by design?

The best “fix” I’ve been able to come up with so far is creating an every turn rule to check the height percentage of a specific person (the player, for example) and forcing the person’s height to change using “now…is”, but that seems like a rather awful kludge.

Have you tried a to decide phrase? This seems to work for me, though I still haven’t updated from 5Z71:

A stature is a kind of value. The statures are short, average, and tall. A person has a number called height percentage. The height percentage is usually 500. To decide what stature is the height of (shorty - person): if the height percentage of shorty is less than 401: decide on short; otherwise if the height percentage of shorty is less than 600: decide on average; otherwise: decide on tall.

From your code it looks to me as though Inform would expect you to set the height explicitly rather than looking at your definition phrases, though I’m not expert in this.

Here’s a short sample game with the “to decide” phrase which seems to work as desired (the cakes and pies just give you a way to change your height, their code is awful):

[spoiler][code]Lab is a room. A cake is a kind of thing. A cake is edible. A pie is a kind of thing. A pie is edible. There are ten cakes in lab. There are ten pies in lab.

A stature is a kind of value. The statures are short, average, and tall.
A person has a number called height percentage. The height percentage is usually 500.
To decide what stature is the height of (shorty - person):
if the height percentage of shorty is less than 401:
decide on short;
otherwise if the height percentage of shorty is less than 600:
decide on average;
otherwise:
decide on tall.

The description of the player is “You’re [height percentage of player] centimeters tall![if height of player is short] You wouldn’t mind being a little taller though.[else if height of player is tall] You wouldn’t mind being a little shorter though.[end if]”

After eating a cake:
increase the height percentage of the player by 50.
After eating a pie:
decrease the height percentage of the player by 50.

[/code][/spoiler]

Thanks matt w, that seems to be what I was aiming for.

You are correct that your (original) example had two different definitions of each adjective (gnomish, dwarfish, etc) – one derived from a property, one derived from the “Definition” statements. One definition was overriding the other.

I think this is by design, but it’s not my favorite design. You can completely override the definition of an adjective, which may be useful for some cases, like adjusting library behavior. But it’s a crude sort of override; it’s not like adding a rule to a rulebook, where you can adjust the priorities or inspect the rulebook in the index to see what’s going on. So it’s better to avoid this. Matt’s solution is fine.

Yeah, it’s a little odd how it handles things but I finally realized the definitions really don’t have any connection to the height value. I’ve settled on eliminating the height value and just using definition statements to define the height of an actor, then a decide block to set a “height of the actor” text for saying the height.