Skip to main content

Syntax

Constants

Constants are static values of a particular type. For example, status is a constant of type BonusType, which is used as part of the bonus Statement to specify what type of bonus (or penalty) is being added to the character.

Functions

Functions take one or more arguments and return a value of a specific type. The name of the function is always followed by a ( after which come the arguments separated by commas, followed by a ) at the end.

For example, the bonus Statement is a function that takes three arguments and returns a value of type BonusParams. Writing a bonus Statement that provides a +1 status bonus to AC looks like:

bonus(1, armor_class, status)

Arrays

A array consists of multiple items of the same type separated by commas and bounded by square brackets ([ and ]). For example, below is a array of Statements:

[
bonus(1, armor_class, status),
bonus(-1, save_modifier(will), status),
set(skill_proficiency(intimidation), expert)
]

Note that whitespace and indentation do not matter when writing an array.

Type Definitions

Throughout this documentation, Constants and Functions are defined using the following syntax.

For Constants:

constant_name: Type

For Functions:

function_name(argument_1_name: Type1, argument_2_name: Type2): ReturnType

Functions may also have multiple definitions which take different arguments, for example:

function_name(argument_1_name: Type1): ReturnType
function_name(argument_1_name: Type2, argument_2_name: Type3): ReturnType

Finally, arrays are defined by adding [] as a suffix to the type of items they contain. In the following case, the function function_name takes one argument which is an array of Type1 items.

function_name(argument_1_name: Type1[]): ReturnType