I haven’t proofread it in detail this time, so there might be some typos, but here’s the last three sections I mentioned earlier.
Punctuation, articles, plurality
Punctuation
The most important unit of punctuation in Inform source text is the period, which naturally enough ends a sentence. Normally, every sentence (and every phrasebook) is expected to end with a period. However, periods are implicitly inserted under two circumstances:- Before a blank line (paragraph break)
- After quoted text ending in a period, exclamation mark, or question mark.
The comma (,) is also pretty significant, but it’s not really discussed in the documentation as far as I can tell. In many contexts it can precede (or even substitute for) the words or and and… but there are some places where that doesn’t appear to work. In assertions it can be placed between adjectives, which can help disambiguate multi-word adjectives in some cases, but that doesn’t seem to work in conditions.
Next on the list of general-purpose punctuation is parentheses (()). Though they have special meanings in many places, and using them in an assertion is not allowed outside of those special meanings, they can be used for grouping in both descriptions and conditions.
For example, suppose you have a room called “Road to Paradise” and want to disable exiting it on foot in a specific direction. The obvious way won’t work:
Instead of going west from Road to Paradise by nothing:
The parser unfortunately sees the “to” in the name and (if I understand correctly) thinks you’re trying to match the room gone to, so it would only match if west of the Road to Paradise was the Road to Paradise. You can work around this issue by enclosing the name of the room in parentheses:
Instead of going west from (Road to Paradise) by nothing:
Lastly, I’ll give an honorable mention to the colon and semicolon, which play a role in phrasebooks. However, their usage was already specified in the section in question, so I won’t say any more than that.
Filler Words
Some people might see my syntax definitions earlier in the thread and wonder, where are the articles? Well, I omitted them for a good reason. The words a, an, the, and some are in most cases treated by Inform as the same as whitespace – they have no semantic effect on the source text.
There are some cases where a specific article is required (such as an actor doing something), and articles can be significant in the name of a phrase because Inform prefers to use a phrase with more words, even if those words are articles. Besides that, there’s at least one more way in which articles are significant – when defining an object (but not a value), Inform looks at the article used and takes it into account when defining the object.
To be more precise, every object has an indefinite article property, which is blank by default. (I think being blank is exactly equivalent to setting it to "a" or "an", whichever is appropriate.) If you define the object via called the «name», Inform sets the indefinite article property to "the". It doesn’t seem to do this with some however, and I’m not completely clear on the rules for this.
However, if the object is defined with some, it does get the plural-named property. Or, if it’s defined with no article at all, it receives the proper-named property. So, the presence or absence of an article will affect how Inform thinks your object should be referred to. Of course, in all cases you can override its guess with a specific assertion.
Speaking of plurality, plurals are another thing that exists in the syntax but has no semantic significance. You can happily write ungrammatical sentences like 'The dogs is in the kitchen" or “Some water are scenery in the beach” and Inform won’t care at all. In other words, the plural and singular forms of a noun or verb are, in nearly all cases, completely interchangeable. The one case I know of where this isn’t true is rule and rules – rule refers to a single rule, but rules is a synonym for rulebook.
The ordinal suffix (and ordinal forms of small numbers) is another example of syntax that exists solely for familiarity but doesn’t have any special meaning. Though ordinal numbers seem to be an error (or misunderstood as part of a name) when used in assertions, in conditions and descriptions they’re synonymous with the equivalent cardinal number.
Imperative assertions
Understand
Understand «topic» as «action name» [( with nouns reversed)] [when/while «condition»].
Understand the command «command-list» as «command».
Understand the command «command» as something new.
Understand nothing as «action name».
These forms all work with verbs – defining a verb to mean an action, giving word-level synonyms, or clearing out previously-defined grammar.
For the first one, there’s a special restriction on the topic – there may not be any alternations on the first word.
Understand «topic» as «value or kind» [when/while «condition»].
Understand «topic» as the plural of «value or kind» [when/while «condition»].
These forms work on nouns. I don’t really have anything more to say here.
Understand «topic» as «token».
The understand token «name» translates into I6 as «quoted I6 identifier».
The token to be defined in the first form must be a quoted string containing nothing but a single square-bracketed token. The topic here is also restricted – it may contain at most one token in it, and if you use alternatives with or, every alternative must be compatible. Either they all contain no tokens, or they all contain a token of the same kind.
Understand «property» as describing «value or kind» [when/while «condition»].
Understand «property» as referring to «value or kind» [when/while «condition»].
Understand «topic» as «adjective».
The “describing” form allows the adjective to be used alone to refer to the object, whereas “referring to” means it can only refer to the object if it appears alongside the object’s name.
And lastly:
Understand «topic» as a mistake [( «text» )] [when/while «condition»].
Test
Text «name» with «script» [holding «thing» [ ( [ , ] and | , ) «thing» ] ] [in «room»].
The script is a quoted list of commands to be run, separated by forward slashes (/). Unlike everywhere else in the language, the forward slash here doesn’t separate words only – it functions more like a semicolon or period. I believe you can use [/] if you need a literal forward slash to be included in a command.
Include
Include [version «version» of] «extension» by «author».
Include (- «Inform 6 code» -) [when defining «kind» | replacing «quoted I6 identifier»].
Use
Use «option» [of at least/most «value»] (and «option» [of at least/most «value»])*.
I’m not going to cover the syntax of how to define use options, since it’s due to be overhauled in the next release.
Release
Release along with «release instruction» (and «release instruction»)*.
Possible release instructions include:
file «text» called «quoted file or directory name»
cover art [( «quoted alt text» )]
introductory booklet/postcard
«quoted template name» website
«quoted interpreter name» interpreter
existing story file [called «quoted filename»]
[public/private] solution
[public/private] source text
[public/private] library card
Index map
Index map with «mapping instruction» (and «mapping instruction»)*.
Possible mapping instructions are:
«room» mapped «cardinal direction» of «room»
«direction» mapped as «cardinal direction»
EPS file
rubric «text» [size «number»] [font «text»] [color «text»] at «offset» [from «room»]
«setting» [of «part»] set to «value»
When adjusting settings, the optional part can be one of the following:
«description of rooms»
«description of regions»
first room
level «number»
The level number can be negative.
Setting values can be any of the following (depending on the setting in question):
«quoted text»
«number»
on/off
«number»&«number»
That last type is called an offset.
The possible settings are:
font
minimum-map-width
title
title-size
title-font
title-colour
map-outline
border-size
vertical-spacing
monochrome
annotation-size
annotation-length
annotation-font
subtitle
subtitle-size
subtitle-font
subtitle-colour
grid-size
route-stiffness
route-thickness
route-colour
room-offset
room-size
room-colour
room-name
room-name-size
room-name-font
room-name-colour
room-name-length
room-name-offset
room-outline
room-outline-colour
room-outline-thickness
room-shape
Basic phrases
General Flow Control
rule succeeds – the containing rule succeeds with no outcome
rule fails – the containing rule fails with no outcome
make no decision – the containing rule makes no decision and produces no outcome
rule succeeds with value – the containing rule succeeds with no outcome and the specified value
«rulebook outcome» – the containing rule succeeds, fails, or makes no decision, and produces the specified outcome
continue the action/activity – equivalent to “make no decision”
stop [the action] – generic “return nothing” statement for phrases
[decide ] yes/no – return true or false
decide on – return specified value
next – go to next loop iteration
break – exit loop
do nothing – the placeholder for when you have a block that needs a phrase but no phrase to put there; this phrase just does nothing.
Blocks
A few core, built-in phrases introduce a block, which is a sequence of statements under the control of the introductory phrase. There are two ways to write a block, but you can’t mix the two ways in the same phrasebook.
The first way is to start with a colon (:) and then indent each subsidiary phrase one level deeper than the level of the controlling phrase. This is similar to how the Python programming language handles scoping.
The other form looks like this:
«first word of phrase» «rest of phrase» begin ; «sequence of subsidiary phrases» end «first word of phrase repeated»
I think it gets a bit more complicated than that in if statements, but at least that’s the basic idea.
Conditionals
if/unless «condition» , «single phrase»
[otherwise/else «single phrase»]
I’m pretty sure one-liners can only use the above form – there’s no “else if” equivalent.
if/unless «condition» : «sequence of phrases»
otherwise/else if/unless «condition» : «sequence of phrases»
otherwise/else : «sequence of phrases»
Note that otherwise and else are completely synonymous. On the other hand, if and unless are opposites – the latter negates the entire condition.
A switch statement has the following structure:
if «value» is : «block of phrases»
( -- «value» : «block of phrases»)*
[ -- otherwise : «block of phrases»]
Note that, unlike in regular conditional statements, we don’t have else as a synonym for otherwise here (which is weird), nor do we have the opion of using unless to negate the entire condition (which wouldn’t make sense in any case). Also note that a switch statement cannot be used in the begin/end style of blocks – if you want to use a switch statement you need to use indentation.
Loops
while «condition» :
repeat with «name» running from «arithmetic or enumerated value» to «value of same kind» :
repeat with «name» running through «description of values» :
repeat through «table name» [in [reverse] [«table column»] order] :
That last one is slightly imprecise – you need at least one of reverse and a table column. It’s not allowed to say in order.
Saying
The say phrase might be the most complicated phrase in the game. I think this is its most general form:
say «sayable thing» (, «sayable thing»)*
where a sayable thing is one of the following:
«text» [( «response letter» )]
«expression evaluating to sayable value»
«say phrase»
Saying a comma-separated list of things seems to be exactly equivalent to saying each of them in turn in separate say statements.
The first form of a sayable thing is by far the most common – any quoted text, with an optional response letter following it. However, it’s interesting to note that if the entire contents of your text is a bracket substitution, you can get the same effect by removing both the quotes and the brackets.
A response letter is only valid in named rules. In particular, it is not valid in named phrases (which seems a little strange to me, honestly). It must be a single uppercase letter, which means you’re limited to at most 26 responses in any given rule. (If you find yourself exceeding this, it’s probably a sign you should split the rule up anyway.) Using this form creates a value of kind response called “«name of the rule» response ( «response letter» )”. A response can be assigned to in assertions as though it’s a variable.
Other
I’m not going to cover every imaginable phrase, as the Phrasebook section in the index is pretty extensive, but I’ll list a few more of the most basic ones here.
let «name» be «value or kind»
When specifying the kind, the «name» must not already exist. However, when specifying a value, the name can already exist, and must be a local variable. (You can’t use let to assign to global variables.) If you only declare the kind, the initial value is the default value of that kind.
now «condition»
As crazy as it seems, this statement takes almost any condition and immediately arranges things so that it’s true. To be more precise, it will only accept the same kinds of conditions that you can use as static assertions. For example, no past tense or calculated adjectives or relations. I’m not sure if there are any types of conditions that work statically but not in now or vice versa.
whether or not «condition» … truth state
This value phrase effectively casts a condition to a truth state value. Since conditions and values are two different things in Inform, this allows converting between them. Note that true and false are not valid conditions on their own, unlike in many programming languages. If you have a truth state variable, you need to test it with is like anything else.
If I’ve missed some basic, core phrase, please let me know.
It is strange that Inform supports unless as the opposite of if but does not support until as the opposite of while – probably an oversight? It would seem to be easy to fix that, but for some reason I can’t get this to work:
To until (c - condition) begin -- end loop:
(- while ~{c} -).
When play begins:
until true is true:
do nothing.
Problem. You wrote ‘until true is true’: but the punctuation here ‘:’ makes me think this should be a definition of a phrase and it doesn’t begin as it should, with either ‘To’ (e.g. ‘To flood the riverplain:’), ‘Definition:’, a name for a rule (e.g. ‘This is the devilishly cunning rule:’), ‘At’ plus a time (e.g. ‘At 11:12 PM:’ or ‘At the time when the clock chimes’) or the name of a rulebook, possibly followed by some description of the action or value to apply to (e.g. ‘Instead of taking something:’ or ‘Every turn:’).
The error seems to indicate that it’s not recognizing that the phrase should begin a block. I can’t get it to work with the begin…end form of blocks either, though that gives different error messages.