User Tools

Site Tools


gen:syntax

Generator Service - Help

Generators are defined using JSON-formatted text. The expected data consists of an object (the generator or root object) which contains name, resultPattern, and tables objects. The name and resultPattern objects are strings, whereas tables is an array of objects.

A table object contains a name and entries objects. The name object is a string and entries is an array of strings.

Example JSON

{
    "name": "Simple NSC Generator",
    "resultPattern": "{name}",
    "tables": [
        {
            "name": "name",
            "entries": [
                "Adam",
                "Eve"
            ]
        }
    ]
}

More details can be found in an example file in the Campaign Logger open repository.

How It Works

The resultPattern and the table entries can contain any text you wish. But text enclosed in curly braces (i.e. { and }) is treated as a table call.

Whenever a table call is encountered, an entry from that table is selected to replace the call. If the selected entry also includes references they get expanded, too. References (and thereby table names) must start with a letter and may only include letters, digits, and blanks. References (and thereby table names) are case-sensitive.

See Also

gen/syntax.txt · Last modified: 2018/02/05 10:00 by E.L.F. Vesala