Dynamic Descriptions — Syntax
Strings — { }
Values to be displayed are wrapped in curly brackets. For example, to embed the current in-game hour in a room description:
It is {time.hour} o'clock.
Numbers and calculations — [ ]
Arithmetic expressions are wrapped in square brackets. The result of a calculation is
not printed automatically; it is stored in {result} and must
be included in the text explicitly:
[{gold}/1000]{result}Kgp
This prints the observer’s gold expressed as thousands of gold pieces.
Conditionals
When a comparison operator appears inside [ ], the expression becomes a
conditional. The text that immediately follows is shown only when the condition is true,
and each conditional block must be closed with a pipe character |.
Example — a skylight that shows sunlight by day and moonlight at night:
#DYou are in Someone's office where
[(({time.hour}>5)&&({time.hour}<20))] sunlight |
[{time.hour}<6] moonlight |
[{time.hour}>19] moonlight |
streams through a skylight.
The same logic using the named day/night variables:
#DYou are in Someone's office where
[{time.day}] sunlight |
[{time.day} == {false}] moonlight |
streams through a skylight.
Text in a Dynamic Description is automatically reflowed (extra line breaks are
discarded). Use #N to insert a hard line break where needed. See
Controls for details.
Because the parser has no implicit operator precedence, parentheses must be used explicitly to group subexpressions:
[ ( ( {time.hour} > 5 ) && ( {time.hour} < 20 ) ) ] sunlight |
Escaping special characters
Prefix any character with a backslash \ to print it literally. This allows
[ ], { }, and ( ) to appear in
output without being interpreted as DD syntax.
Worked example
Using the skylight conditional above, the MCF room long-description section would be:
#DYou are in Someone's office where
[(({time.hour}>5)&&({time.hour}<20))] sunlight |
[{time.hour}<6] moonlight |
[{time.hour}>19] moonlight |
streams through a skylight.
During the day (hours 6–19), looking at the room shows:
Someone's Office [Exits: north ] You are in Someone's office where sunlight streams through a skylight.
At night:
Someone's Office [Exits: north ] You are in Someone's office where moonlight streams through a skylight.
See the Example Descriptions page for nine annotated examples drawn from actual Continents areas.