| Chapter 21: Extensions |

| 21.17. Catalogue of named Inform 7 types

The four most basic types are number, time, text, and object. Numbers translate into I6 as integer constants. Times are stored according to I6 convention, and objects as I6 object names, in the natural way.

Text is stored as either a string constant (if the text is fixed) or as an I6 routine to print it (if it is variable, by containing substitutions). Thus a substitution for "text" might turn out to be an I6 value of metaclass String, or of metaclass Routine. An I6 phrase definition needing to distinguish the possibilities can either use the I6 function "metaclass", or else two different definitions can be given, one using the type "string-of-text" and the other "text-routine" (see below).

There follows a selection of the exotic types currently present in I7 which extensions might conceivably need to use in phrase definitions, but which in general are not values. Even some of those which are values cannot be stored in variables.

action (not a value). Matches an explicit I7 action, e.g. "taking the wooden box" (but not an imprecise description of an action such as "taking something portable"). Translates into I6 as code in void context which causes this action.

boxed-quotation (not a value). Matches text used for a boxed quotation. Translates into the necessary I6 arguments for the "box" statement.

condition (not a value). Matches any I7 condition, e.g. "the wooden box is open". Translates into an I6 value which is non-zero if and only if the condition holds.

description (a value, but with some limitations on use). Matches any I7 description, e.g. "open containers which are in dark rooms". Translates into the address of an I6 routine which determines whether an object does or does not match the description.

miscellaneous-value (a value). Many values in I6 - most of the library properties, for instance - are known to be an object, a class, a routine or a string, but might be any of the four. I7 uses the umbrella type "miscellaneous-value" for exactly this ambiguity. Translates into the relevant I6 value, which I6 code can then disambiguate using the "metaclass" function.

object-based-rulebook (not a value). Never matches in phrase definitions. It exists solely for sentences creating rulebooks: "The judgement rules are an object-based-rulebook" differs from "The judgement rules are a rulebook" in that the rulebook created is applied to a specific object whenever it is run, rather than being applied to a specific action (or to nothing). Once created, the type of the name of the rulebook in question is simply "rulebook".

property (not a value). Matches the name of an I7 property, either an either/or property such as "open" or a value property such as "capacity". Translates into I6 as the corresponding I6 property name (for value properties); or as the name of the corresponding I6 attribute (for either/or properties), prefaced by "~" if the attribute is referred to in the negation of its normal state; except that, in order to escape the Z-machine's limit on the number of attributes, I7 stores some either/or properties as I6 properties whose values are always "true" or "false", and these properties are translated to I6 as the relevant property names. (These less efficiently stored either/or properties are distinguished by having property numbers equal to, or greater than, the I6 constant I7_FBNA.)

rule (a value). Matches the literal name of a rule. Translates into I6 as the name of the I6 routine which carries out this rule.

snippet (a value). There is no literal way to write a constant snippet, but several snippet variables exist inside I7, such as "topic understood", and as this indicates they can be stored in global variables (though not local "let" variables). Snippets describe a range of words in the player's most recent command. As a result, any surviving snippet values become meaningless when a new command is typed in, or when a replacement or cut is made to the standing command. Input words are numbered from 1, as in standard I6 practice; the snippet between word number N to word number M inclusive is represented as the integer 100*N + (M-N+1), so for instance the snippet of 7 words starting at word 3 is represented as 307. Snippets translate into I6 as this integer value.

string-of-text (a value). A type used to require text which contains no substitutions. Translates into I6 as the name of the I6 routine which prints this text (and therefore a value of I6 metaclass Routine).

text-routine (a value). A type used to require text which contains at least one square-bracketed substitution. Translates into I6 as the I6 string (and therefore a value of I6 metaclass String).

unicode-character (translates to a value). Matches a literal unicode character, e.g. "unicode 78" or, if names for Unicode characters have been defined, "unicode Greek letter kappa". Translates into I6 as the character number, e.g. 78 or 922.

The following are likely not useful, since they translate into identification numbers which are not predictable and not easy to correlate with anything outside of some internal data structures: however -

abstract-relation (translates to a value). Matches the literal name of a relation, e.g. "adjacency relation". Translates into I6 as a number uniquely identifying this relation.

activity (translates to a value). Matches the literal name of a activity. Translates into I6 as a number uniquely identifying this activity.

rulebook (translates to a value). Matches the literal name of a rulebook. Translates into I6 as a number uniquely identifying this rulebook.

scene (translates to a value). Matches the literal name of a scene, e.g. "Brief Encounter". Translates into I6 as a number uniquely identifying this scene.

table-column (translates to a value). Matches the literal name of a table column. Translates into I6 as a number uniquely identifying this column name. (The same column name in two different tables comes out with the same table-column value.)

table-name (a value). Matches the literal name of a table, and can also be stored in global variables and properties. Translates into I6 as an address uniquely associated with the table (in a way which should not be relied upon).

use-option (translates to a value). Matches the literal name of a use option, e.g. "American dialect". Translates into I6 as a number uniquely identifying this option. The value is independent of whether the option is currently being used or not.

And the following exotic types should never be used outside of the Standard Rules: outcome, phrase, returned, table-reference, topic, variable, void. Finally, note that kind is not a type at all, and cannot be used in phrase definitions.

Previous | Contents | Next