Chapter 24: Extensions
24.25. Inform 6 adjectives

There are two ways to specify that an adjective is defined at the I6 level. Adjectives can play several roles in Inform, but here we mean the simplest sort: adjectives which can be tested but can't be forced true or false. In I7 source text, these are normally defined using the "Definition:" syntax, and a variation on that allows them to be defined in terms of I6 code as well.

For example:

Definition: a number is prime rather than composite if I6 routine
    "PRIMALITY_TEST" says so (it is greater than 1 and is divisible only by itself and 1).

Inform now actually tests if a number N is prime by calling PRIMALITY_TEST(N), and it assumes that we have also included such a routine in the output. The routine is expected to return true or false accordingly.

The text in brackets does nothing functional, but is the text used in the Lexicon dictionary part of the Phrasebook index for the user's benefit; it should be a brief definition. Extension authors are asked to provide these little definitions, so that their users won't be confused by blank lexicon entries.

A second way to define an adjective, which should be used only if the first way can't be used or if speed is exceptionally important, is to provide a "schema" - a sort of I6 macro, like those provided by the C preprocessor. For example:

Definition: a rulebook is exciting if I6 condition
    "excitement_array-->(*1)==1" says so (it is really wild).

The escape "*1" is expanded to the value on which the adjective is being tested. (This is usually faster than calling a routine, but in case of side-effects, the "*1" should occur only once in the condition, just as with a C macro.) To repeat: if in doubt, use the I6 routine method above.


PreviousContentsNext