Inform 7 Home Page / Documentation


§11.4. The showme phrase

We've already seen the SHOWME command, which can be typed into the Story panel to look at the state of something, usually a thing or room. SHOWME is a testing command which has no effect once the work is released; eventual players can't use it.

Inform also has a phrase called "showme", which works in much the same way:

showme (value)

This phrase is intended for testing purposes only. If used in a story file running inside the Inform application, it prints a line of text showing the given value and its kind; in a Released story file, it does noth ng at all. Example:

When play begins: showme 11.

produces

number: 11

More usefully:

Every turn: showme the score.

Now, every turn, we get a line in the story's transcript like so:

"score" = number: 0

Inform uses the quotation marks and equals sign to show that it had to do some work to find the answer. "score" wasn't a constant value - it was a variable, and Inform had to look up the current value.

"showme" is a convenient way to see what's going on inside a phrase which isn't behaving as expected, or to find out the kind of a value. Here are some trickier examples. Suppose our design includes:

The matching key of the blue door is the brass Yale key.

If we then try this:

When play begins:
    showme matching key of the blue door.

we get, when the story starts up,

"matching key of the blue door" = object: brass Yale key

Why is this an "object", when we know that the key is actually a "thing"? After all, if we "showme key" instead, we get:

thing: brass Yale key

The answer is a little technical: it's because Inform guarantees that the matching key is always an object, but not that it's always a thing - it just happens to be a thing at the moment. There's not really a contradiction, because a "thing" is a kind of "object", so in fact the key is both. If we try "showme matching key", we get something like this:

objects valued property: property 23

which is even more technical - people never need to print the names of abstract property names during play, so Inform doesn't provide any good way of doing it. It is reduced to printing out an internal ID number ("property 23") instead of the name ("matching key"). This can't be helped: "showme" is a way to lift the lid and see what's going on inside Inform's machinery, and some of the corners are dark.

All the same, "showme" can be very useful in tinkering with rules to make them work properly. It prints nothing at all in a Release version of a project, so it's impossible for these private notes to be shown accidentally to our eventual readers.


arrow-up.png Start of Chapter 11: Phrases
arrow-left.png Back to §11.3. Pattern matching
arrow-right.png Onward to §11.5. Conditions and questions