Story Builder

The StoryBuilder system works using a JSON object that looks like the one below

{
  framework: '{{ start }} {{ end }}',
  start: 'This is the start.',
  end: 'This is the finish.'
}

The property labelled ‘framework’ is the basis for how a story should be build out. Text between the double brackets indicates that the data should be pulled from another property. This behaviour happens until all possible double brackets have been removed. The result of running the above object through the generator would be

This is the start. This is the finish.

When a JSON array is used, an item from the array will be randomly selected. As such, the following framework

{
  framework: '{{ start }} {{ end }}',
  start: [ 'This is the start.', 'A long time ago...' ],
  end: 'This is the finish.'
}

Could generate either

This is the start. This is the finish.

Or

A long time ago... This is the finish.

Additionally, the Pipe symbol (|) can be used to indicate a line break.

{
  framework: '{{ start }}|{{ end }}',
  start: 'This is the start.',
  end: 'This is the finish.'
}

Would result in

This is the start.
This is the finish.

Modifiers
The following modifiers will change the way a value is generated
* – pluralises

{{ *noun }}

. – gets present participle

{{ .noun }}

^ – Capitalises a word

{{ ^noun }}

< - Gets the past participle

{{ < noun }}

! – Singularises a value

 {{ !noun }}

Saving Values
Sometimes you want to save the value that is selected for use later, often names are a good example of this. This can be done by use of the colon, followed by a variable name. For example

{
  framework: '{{ start }}|{{ end }}',
  start: 'I remember meeting {{ name : herName }}.',
  end: '{{ name: herName }} was the worst.'
  name: ['Vanessa', 'Georgina', 'Serena' ]
}

Will reliably output only one of the names, for example

I remember meeting Serena. Serena was the worst

The below list is a complete list of different word lists that already exist and can be referenced by default
* name
* noun
* adjective
* adverb
* preposition
* verb
* time
* timeofday
* bodypart
* location
* drink
* place
* number (outputs range of 2 – 92, I have no good explanation for why)

Leave a Reply

Your email address will not be published. Required fields are marked *