Variable types

DD provides three categories of variables:

  1. Calculation-only — can be used inside [ ] math or conditional expressions, but cannot be printed directly. Examples: time.morning, race.elf, affect.flying.
  2. Display-only — can be printed using { }, but cannot be used in calculations. Examples: {result}, {name}, {he/she}.
  3. Both — can be either printed or used in calculations. When wrapped in [ ] the numeric value is used; when in { } the string form is shown. For example, if a hobbit looks at a description, [{race}]{result} prints 7 while {race} prints Hobbit.

See the Variables page for the complete list, and the Lookups page for all enumerated values.

Math expressions

DD supports arithmetic inside [ ] blocks. For example:

[{gold}/1000]{result}Kgp

prints the number of thousands of gold pieces the observer is carrying. Math results are stored in {result} and must be explicitly printed — the calculation itself produces no output.

Conditionals

Whenever a comparison operator appears inside a [ ] block, the expression becomes conditional. The text that follows the block is displayed only when the condition is true, and each conditional block must be terminated with a pipe character |.

Known limitations

Left-associative arithmetic: The calculator has no operator precedence. 5+6*7 evaluates as ((5+6)*7) = 77, not 47. Always use explicit parentheses in complex expressions.

No else clause: Conditionals only test for truth. To display one message when a player is flying and a different message when not, two separate conditional blocks are required:

[{position.flying} == true]  message when flying     |
[{position.flying} == false] message when not flying |