Acts
act
Extracts all possible ‘Acts’ from the given arguments. Defaults to the current Act, if no arguments are given.
act(...elements) ➜ List[Act]
Arguments
|
Return Values
act.fullText
Returns the full text of each ‘Act’ in the given arguments (or the current Act if none are provided).
act.fullText(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | A list of text containers, each containing the full text of any acts that can be extracted from the given arguments. The list is also sorted by their order in the manuscript. FormatInherited The preferred rendering format is kept as is. Elements
|
act.name
Returns the custom name of each ‘Act’ in the given arguments (or the current Act if none are provided).
act.name(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | A list of text containers, each containing the name of any acts that can be extracted from the given arguments. Acts without a custom name will be skipped. FormatInherited The preferred rendering format is kept as is. Elements
|
act.next
Returns the immediately following 'Act' for each possible 'Act' in the given arguments (or the current Act if none are provided).
act.next(...elements) ➜ List[Act]
Arguments
|
Return Values
act.number
Returns the number of each 'Act' in the given arguments (or the current Act if none are provided).
act.number(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
Examples
To get the number of the current act:
{act.number}
2
To get the act numbers of all acts in the story so far:
{act.number(storySoFar)}
1, 2, 3
act.previous
Returns the immediately preceding 'Act' for each possible 'Act' in the given arguments (or the current Act if none are provided).
act.previous(...elements) ➜ List[Act]
Arguments
|
Return Values
act.summary
Returns a summary of each 'Act' in the given arguments (or the current Act if none are provided).
act.summary(...elements) ➜ List[Outline]
Arguments
|
Return Values
List | A list of outlines, one for each Act, containing their summaries. FormatInherited The preferred rendering format is kept as is. Elements
|
act.title
Returns the full title for each possible 'Act' in the given arguments (or the current Act if none are provided).
act.title(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | A list of text containers, each holding the title of an Act. FormatInherited The preferred rendering format is kept as is. Elements
|
isAct
Filters the given collection of items to only those that are an actual 'Act'
isAct(...elements) ➜ List[Act]
Arguments
|
Return Values
Examples
This function is a filter that can be used to filter mixed values, like those coming from input.
{isAct(input("Additional Context"))}
<act title="Act 1">
...
</act>
Chapters
chapter
Extracts all possible 'Chapters' from the given arguments. Defaults to the current Chapter, if no arguments are given.
chapter(...elements) ➜ List[Chapter]
Arguments
|
Return Values
chapter.fullText
Returns the full text/prose for each possible 'Chapter' in the given arguments (or the current Chapter if none are provided).
chapter.fullText(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
chapter.name
Returns the custom name for each possible 'Chapter' in the given arguments (or the current Chapter if none are provided).
chapter.name(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | A list of text containers, each holding the custom name of a Chapter. Chapters without a custom name are omitted. FormatInherited The preferred rendering format is kept as is. Elements
|
chapter.next
Returns the immediately following 'Chapter' for each possible 'Chapter' in the given arguments (or the current Chapter if none are provided).
chapter.next(...elements) ➜ List[Chapter]
Arguments
|
Return Values
chapter.number
Returns the number for each possible 'Chapter' in the given arguments (or the current Chapter if none are provided).
chapter.number(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | A list of text containers, each holding the number of a Chapter. FormatInherited The preferred rendering format is kept as is. Elements
|
chapter.previous
Returns the immediately preceding 'Chapter' for each possible 'Chapter' in the given arguments (or the current Chapter if none are provided).
chapter.previous(...elements) ➜ List[Chapter]
Arguments
|
Return Values
chapter.summary
Returns the scene summaries for each possible 'Chapter' in the given arguments (or the current Chapter if none are provided).
chapter.summary(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
Examples
{chapter.summary}
<chapter title="Chapter 1: A curious case of missing socks" number="1">
<scene number="1">
Lola was doing her laundry when she noticed that one of her socks was missing.
She searched everywhere for it, before asking her BFF, Molly, for help.
</scene>
<scene number="2">
Lola and her dog Max are playing in the garden, when out of nowhere, Max comes running with a sock in his mouth.
</scene>
</chapter>
chapter.title
Returns the full title for each possible 'Chapter' in the given arguments (or the current Chapter if none are provided).
chapter.title(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | A list of text containers, each holding the title of a Chapter. FormatInherited The preferred rendering format is kept as is. Elements
|
isChapter
Filters the given collection of items to only those that are an actual 'Chapter'.
isChapter(...elements) ➜ List[Chapter]
Arguments
|
Return Values
Examples
This function is a filter that can be used to filter mixed values, like those coming from input.
{isChapter(input("Additional Context"))}
<chapter title="Chapter 1">
...
</chapter>
Codex
codex.aliases
Returns the aliases for each possible 'Codex' entry in the given arguments (or the current Codex context if none are provided).
Entries without an alias will be ignored.
codex.aliases(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
Examples
Get aliases from current Codex context
Assuming a character “Peter Miller” with aliases “Pete, Petey” is in the current context:
{codex.aliases}
Pete, Petey
Get aliases for specific Codex entries
{codex.aliases("Peter Miller", "Charlene Smith")}
Pete, Petey, Charlie
Get a list of all the aliases
Since all aliases are returned as a regular list, you might want to render them as an ordered or bulleted version instead:
{asList(codex.aliases(codex.category("Nicknamed Characters")))}
- Pete, Petey
- Charlie
codex.all
Returns all Codex entries, or extracts them from the given arguments.
codex.all(...elements) ➜ List[Codex Entry]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.category
Returns the custom Codex category by name, or for each possible 'Codex' entry in the given arguments (or the current Codex context if none are provided).
codex.category(...elements) ➜ List[Codex Category]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.characters
Returns/Extracts all Codex entries that are of type 'Character'.
codex.characters(...elements) ➜ List[Codex Entry]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.context
Returns the current codex context, or filters the given arguments by whether they are in the current codex context.
codex.context(...elements) ➜ List[Codex Entry]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.description
Returns the description for each possible ‘Codex’ entry in the given arguments (or the current Codex context if none are provided).
codex.description(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | For each Codex entry, a text container is returned: FormatInherited The preferred rendering format is kept as is. Elements
|
codex.detail
Returns the given custom details for each possible 'Codex' entry in the given arguments (or the current Codex context if none are provided).
codex.detail(...entries, details) ➜ List[Codex Detail]
Arguments
Entries |
| ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Details |
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.get
Retrieves one or more Codex entries by their name or alias, or extracts them from the given arguments.
codex.get(...elements) ➜ List[Codex Entry]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
Examples
Get specific Codex entries by name
{codex.get("Doris", "Joe's Diner")}
<character name="Doris" occupation="Waitress">
Doris is a waitress at Joe's Diner.
</character>
<location name="Joe's Diner" type="Restaurant">
Joe's Diner is a popular eatery in the town of Springfield.
</location>
Get Codex entries from a Codex category
Assuming “Main Characters” is a defined Codex category:
{codex.get(codex.category("Main Characters"))}
<character name="Alice" role="Protagonist">
Alice is the main character of the story.
</character>
<character name="Bob" role="Antagonist">
Bob is the main character's rival.
</character>
codex.global
Returns/Extracts all Codex entries that are marked as global (always included).
codex.global(...elements) ➜ List[Codex Entry]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.has
Checks if the given arguments contain any (valid) Codex entries.
codex.has(...elements) ➜ Boolean
Arguments
|
Return Values
Boolean | Returns true/false whether any of the given arguments are valid Codex entries. |
codex.hasDetail
Filters all Codex entries in given arguments (or the current Codex context if none are provided) by whether they have the given detail(s).
codex.hasDetail(...entries, details) ➜ List[Codex Entry]
Arguments
Entries |
| ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Details |
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.hasTag
Filters all Codex entries in given arguments (or the current Codex context if none are provided) by whether they have the given tag(s).
codex.hasTag(...entries, tags) ➜ List[Codex Entry]
Arguments
Entries |
| ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Tags |
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.inCategory
Filters all Codex entries in given arguments (or the current Codex context if none are provided) by whether they are in the given custom category/categories.
codex.inCategory(...entries, categories) ➜ List[Codex Entry]
Arguments
Entries |
| ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Categories |
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.isCharacter
Filters all Codex entries in given arguments (or the current Codex context if none are provided) by whether they are of type 'Character'.
codex.isCharacter(...elements) ➜ List[Codex Entry]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.isLocation
Filters all Codex entries in given arguments (or the current Codex context if none are provided) by whether they are of type 'Location'.
codex.isLocation(...elements) ➜ List[Codex Entry]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.isLore
Filters all Codex entries in given arguments (or the current Codex context if none are provided) by whether they are of type 'Lore'.
codex.isLore(...elements) ➜ List[Codex Entry]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.isObject
Filters all Codex entries in given arguments (or the current Codex context if none are provided) by whether they are of type 'Object'.
codex.isObject(...elements) ➜ List[Codex Entry]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.isOfType
Filters all Codex entries in given arguments (or the current Codex context if none are provided) by whether they are of the given type(s).
codex.isOfType(...entries, types) ➜ List[Codex Entry]
Arguments
Entries |
| ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Types |
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.isOther
Filters all Codex entries in given arguments (or the current Codex context if none are provided) by whether they are of type 'Other'.
codex.isOther(...elements) ➜ List[Codex Entry]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.isRelatedTo
Filters all Codex entries in given arguments (or the current Codex context if none are provided) by whether they are related to the given entry/entries (even across other Codex entries).
codex.isRelatedTo(...entries, related) ➜ List[Codex Entry]
Arguments
Entries |
| ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Related |
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.isSubplot
Filters all Codex entries in given arguments (or the current Codex context if none are provided) by whether they are of type 'Subplot'.
codex.isSubplot(...elements) ➜ List[Codex Entry]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.locations
Returns/Extracts all Codex entries that are of type 'Location'.
codex.locations(...elements) ➜ List[Codex Entry]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.lore
Returns/Extracts all Codex entries that are of type 'Lore'.
codex.lore(...elements) ➜ List[Codex Entry]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.mentions
Retrieves all Codex entries that are mentioned in the given text/arguments.
codex.mentions(...elements) ➜ List[Codex Entry]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.name
Returns the name for each possible ‘Codex’ entry in the given arguments (or the current Codex context if none are provided).
codex.name(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | For each Codex entry, a text container is returned: FormatInherited The preferred rendering format is kept as is. Elements
|
Examples
Let’s say that our current Codex context consists of characters like “Alice”, “Bob” and “Charlie”, as well as locations like “The Forest” and “The Castle”.
We can use codex.name to get the an easy list of names of all entries in the current context:
{codex.name}
Alice, Bob, Charlie, The Forest, The Castle
You can also give it a specific list of codex entries to get the name for. If we only want to get the names of the locations (from the current context again), we can provide it with codex.locations:
{codex.name(codex.locations)}
The Forest, The Castle
If you don’t want to pull from the current context, you can also give it
codex.notes
Returns the notes for each possible ‘Codex’ entry in the given arguments (or the current Codex context if none are provided).
codex.notes(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | For each Codex entry, a text container is returned: FormatInherited The preferred rendering format is kept as is. Elements
|
codex.objects
Returns/Extracts all Codex entries that are of type 'Object/Item'.
codex.objects(...elements) ➜ List[Codex Entry]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.other
Returns/Extracts all Codex entries that are of type 'Other'.
codex.other(...elements) ➜ List[Codex Entry]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.relations
Returns all Codex entries that are related to the given arguments (or the current Codex context if none are provided).
codex.relations(...elements) ➜ List[Codex Entry]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
codex.subplots
Returns/Extracts all Codex entries that are of type 'Subplot'.
codex.subplots(...elements) ➜ List[Codex Entry]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
withRelations
Appends all Codex entries that are related to the given arguments (or the current Codex context if none are provided).
withRelations(...elements) ➜ List[Codex Entry]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
Composition
include
Evaluates in the prompt component with the given name (case-insensitive).
include(name) ➜ Text
Arguments
Name |
|
---|
Return Values
Text | The final evaluated text of the prompt component. |
input
Returns the value for the custom input with the given name (case-insensitive).
input(name) ➜ Any Type
Arguments
Name |
|
---|
Return Values
Any Type | The value of the custom input. If no input with the given name exists, an empty list is returned. |
local
Stores or retrieves a value in the local memory of the current prompt (case-sensitive).
If a value is provided, it will be stored; if no value is provided, the stored value will be returned.
local(name, value?) ➜ Any Type or Boolean
Arguments
Context
hasMessage
Checks if there is any message content in the current scene beat/chat/text replacement selection.
hasMessage ➜ Boolean
Return Values
Boolean | Returns true/false whether there is any message content in the current selection. |
hasTextAfter
Checks if there is any text content immediately following the current position in a document/scene.
hasTextAfter ➜ Boolean
Return Values
Boolean | Returns true/false whether there is text after the current position. |
hasTextBefore
Checks if there is any text content immediately preceding the current position in a document/scene.
hasTextBefore ➜ Boolean
Return Values
Boolean | Returns true/false whether there is text before the current position. |
isEndOfText
Checks if the current position is at the end of a document/scene (i.e., no text after).
isEndOfText ➜ Boolean
Return Values
Boolean | Returns true/false whether the current position is at the end of a document/scene. |
isStartOfText
Checks if the current position is at the start of a document/scene (i.e., no text before).
isStartOfText ➜ Boolean
Return Values
Boolean | Returns true/false whether the current position is at the start of a document/scene. |
message
Retrieves the message content of the current scene beat/chat/text replacement selection.
message ➜ Text Container
Return Values
Text Container | The message content of the current scene beat/chat/text replacement selection. FormatMarkdown The text will be rendered with Markdown formatting/styles, preceded by the title (if any). |
storySoFar
Returns the summaries of the current novel up to the current position (or the position determined by the given arguments).
storySoFar(...elements) ➜ Outline
Arguments
Elements |
| ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Elements |
|
Return Values
Examples
If you want to get the full novel outline of all prior scenes, don’t provide any arguments:
{storySoFar}
If you only want to get the story so far from a specific viewpoint, you can provide a pov argument:
{storySoFar(pov)}
You can also provide a custom outline to filter by, like only within the current act:
{storySoFar(act)}
It’s also possible to combine mix and match the arguments. In those cases it takes the insection of the scenes that match the given outline(s) and POV(s):
{storySoFar(act, pov)}
storyToCome
Returns the summaries of the current novel from the current position (or the position determined by the given arguments) to the end.
storyToCome(...elements) ➜ Outline
Arguments
Elements |
| ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Elements |
|
textAfter
Retrieves the text content immediately following the current position in a document/scene.
textAfter ➜ Text Container
Return Values
Text Container | The text content after the current position, formatted as a markdown text container. FormatMarkdown The text will be rendered with Markdown formatting/styles, preceded by the title (if any). |
textBefore
Retrieves the text content immediately preceding the current position in a document/scene.
textBefore ➜ Text Container
Return Values
Text Container | The text content before the current position, formatted as a markdown text container. FormatMarkdown The text will be rendered with Markdown formatting/styles, preceded by the title (if any). |
textSoFar
Returns the text content of the current novel up to the current position (or the position determined by the given arguments).
textSoFar(...elements) ➜ List[Outline, Text Container]
Arguments
Elements |
| ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Elements |
|
Return Values
List | FormatXML The text will be (recursiveley) rendered as XML elements, with tags and attributes. Elements
|
Examples
If you want to get the full novel text up until the current position, don’t provide any arguments:
{textSoFar}
If you only want to get the text so far from a specific viewpoint, you can provide a pov argument:
{textSoFar(pov)}
You can also provide a custom outline to filter the text by, like only within the current act:
{textSoFar(act)}
It’s also possible to combine mix and match the arguments. In those cases it takes the insection of the scenes that match the given outline(s) and POV(s):
{textSoFar(act, pov)}
textToCome
Returns the text content of the current novel from the current position (or the position determined by the given arguments) to the end.
textToCome(...elements) ➜ List[Outline, Text Container]
Arguments
Elements |
| ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Elements |
|
Return Values
List | FormatXML The text will be (recursiveley) rendered as XML elements, with tags and attributes. Elements
|
Lists
all
Creates a new list from the given arguments, whose matching mode is set to "all".
all(...elements) ➜ List
Arguments
Any type of listable arguments to be included in the list.
|
Return Values
List | Returns a new list from the given arguments, whose matching mode is set to "all". FormatInherited The preferred rendering format is kept as is. |
any
Creates a new list from the given arguments, whose matching mode is set to "any".
any(...elements) ➜ List
Arguments
Any type of listable arguments to be included in the list.
|
Return Values
List | Returns a new list from the given arguments, whose matching mode is set to "any". FormatInherited The preferred rendering format is kept as is. |
count
Returns the total number of elements in the given arguments.
count(...elements) ➜ Number
Arguments
Any type of listable arguments to be included in the list.
|
Return Values
Number | Returns the total number of elements in the given arguments. |
join
Joins all given arguments into a single text value.
join(...elements) ➜ Text
Arguments
|
Return Values
Text | Returns a single text value that is the result of joining all given arguments. |
takeFirst
Returns the first N elements from the given arguments.
takeFirst(...elements, count) ➜ List
Arguments
Return Values
List | A list of the first FormatInherited The preferred rendering format is kept as is. |
takeLast
Returns the last N elements from the given arguments.
takeLast(...elements, count) ➜ List
Arguments
Return Values
List | A list of the last FormatInherited The preferred rendering format is kept as is. |
without
Returns the haystack without the needle.
without(...elements, contained) ➜ List
Arguments
Return Values
List | A list with the given elements, without the contained element. FormatInherited The preferred rendering format is kept as is. |
Logic
and
Filters the given arguments to all those that match to being true.
and(...elements) ➜ List[Any Type]
Arguments
|
contains
Filters the given haystack if they contains the given needle (case-insensitive).
contains(...haystack, needle) ➜ List[Any Type]
Arguments
either
Returns the first argument that matches to not being empty.
either(...elements) ➜ Any Type
Arguments
|
Return Values
Any Type | Returns the first argument that matches to not being empty. |
endsWith
Returns true if the given haystack ends with the given needle (case-insensitive).
endsWith(...haystack, needle) ➜ Boolean
Arguments
Haystack |
| ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Needle |
|
Return Values
Boolean | True if the haystack ends with any of the needle matches. |
ifs
Returns the value for the first condition that is true, or the last value if none are true (e.g. "ifs(conditionA, valueA, conditionB, valueB, valueFallback)").
ifs(...elements) ➜ Any Type
Arguments
|
Return Values
Any Type | Returns the value for the first condition that is true, or the last value if none are true. |
isEmpty
Returns true if all given arguments matches to being empty.
isEmpty(...elements) ➜ Boolean
Arguments
|
Return Values
Boolean | Returns true if all given arguments matches to being empty. |
isEqual
Returns true if all given arguments match to being equal to the first argument.
isEqual(...elements) ➜ Boolean
Arguments
|
Return Values
Boolean | Returns true if all given arguments match to being equal to the first argument. |
isGreaterOrEqual
Returns true if the first argument is greater than or equal to the second argument.
isGreaterOrEqual(expected, actual) ➜ Boolean
Arguments
Return Values
Boolean | Returns true if the first argument is greater than or equal the second argument. |
isGreaterThan
Returns true if the first argument is greater than the second argument.
isGreaterThan(expected, actual) ➜ Boolean
Arguments
Return Values
Boolean | Returns true if the first argument is greater than the second argument. |
isLessOrEqual
Returns true if the first argument is less than or equal to the second argument.
isLessOrEqual(expected, actual) ➜ Boolean
Arguments
Return Values
Boolean | Returns true if the first argument is less than or equal the second argument. |
isLessThan
Returns true if the first argument is less than the second argument.
isLessThan(expected, actual) ➜ Boolean
Arguments
Return Values
Boolean | Returns true if the first argument is less than the second argument. |
isNotEqual
Returns true if all given arguments match to not being equal to the first argument.
isNotEqual(...elements) ➜ Boolean
Arguments
|
Return Values
Boolean | Returns true if all given arguments match to not being equal to the first argument. |
not
Returns true if any of the given arguments match to being false.
not(...elements) ➜ Boolean
Arguments
|
Return Values
Boolean | Returns true if any of the given arguments match to being false. |
or
Filters the given arguments to any those that match to being true.
or(...elements) ➜ List[Any Type]
Arguments
|
startsWith
Returns true if the given haystack starts with the given needle (case-insensitive).
startsWith(...haystack, needle) ➜ Boolean
Arguments
Haystack |
| ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Needle |
|
Return Values
Boolean | True if the haystack starts with any of the needle matches. |
Math
ceil
Rounds each given number up to the nearest full number.
ceil(...elements) ➜ List[Number]
Arguments
|
Return Values
divide
Divides the first number by the second number.
divide(...numbers, divisor) ➜ List[Number]
Arguments
Return Values
floor
Rounds each given number down to the nearest full number.
floor(...elements) ➜ List[Number]
Arguments
|
Return Values
isNumber
Checks if each given argument can be a number.
isNumber(...elements) ➜ List[Boolean]
Arguments
|
Return Values
multiply
Multiplies the first number by the second number.
multiply(...numbers, multiplier) ➜ List[Number]
Arguments
Return Values
round
Rounds each given number to the nearest full number.
round(...elements) ➜ List[Number]
Arguments
|
Return Values
Novels
novel
Returns the current Novel, if available.
novel ➜ Novel
Return Values
Novel | The current <novel /> tag with title, author and tense attribute, if available. |
Examples
Returns the current Novel, if available.
{novel}
<novel title="My Awesome Novel" author="Me" tense="past" />
novel.author
Returns the author of the current Novel.
novel.author ➜ Text Container
Return Values
Text Container | Reference
FormatPlain Text Contents will be rendered without any formatting/styles, preceded by the title (if any). |
Examples
Returns the author of the current Novel.
{novel.author}
Me
novel.fullText
Returns the full text hierarchy of the current Novel, or the text for the given arguments (e.g. Acts, POVs, ...).
novel.fullText(...elements) ➜ Outline
Arguments
|
Return Values
Examples
Returns the full text hierarchy of the current Novel, or the text for the given arguments (e.g. Acts, POVs, …).
{novel.fullText}
<outline>
<act title="Notes for New Users">
<chapter title="Introduction">
<scene title="Scene 1" number="1">
The salt spray stung my face as the Iron Lady sliced through the waves. Another sunrise over the endless blue. I squinted, my eyes struggling to adjust to the glare reflecting off the froth that whipped at the bow. Seven seas. We'd sailed through them all, from the churning, storm-tossed North Atlantic to the languid calm of the South China Sea. Each voyage etched another line on my brow, another tale whispered by the wind.
The world was a tangle of ivory and mahogany under the ship's unsteady lights. The groans of the timbers were lullabies I knew by heart. The rhythmic slap of waves against the hull – a steady beat to the symphony of the ocean. The scent of tar, sweat, and brine hung heavy in the air. My gaze drifted to the receding coastline.
"Cap'n, you lookin' for a ghost story?"
Murphy, our Irish boatswain, leaned against the rail beside me, a mug of black tea warming his hands. He was a good man, Murphy, loyal as the day is long. He was the only one who knew the weight I carried, the gambling debts that threatened to drag me under.
"Lost in thought, that's all," I mumbled, taking a swig from my own mug.
"Thought you were fond of that blue yonder." He grunted, eyes glued to the horizon. "There's a story out there, somewhere. For every sunset, a tale for the telling."
I forced a chuckle. Murphy was a dreamer, but his words echoed a truth I often buried under layers of duty and deceit. The sea, she held secrets. treacherous ones.
"Truth is," I said, "a lot of this journey is about escaping the stories, not catching them."
</scene>
</chapter>
<chapter title="Legend">
<scene title="Scene 1" number="1"/>
</chapter>
<chapter title="Our Story">
<scene title="Scene 1" number="1"/>
</chapter>
</act>
<act number="1" title="The Giant Rat of Sumatra">
<chapter number="1">
<scene title="Scene 1" number="1"/>
</chapter>
<chapter number="2">
<scene title="Scene 1" number="1"/>
</chapter>
<chapter number="3">
<scene title="Scene 1" number="1"/>
</chapter>
<chapter number="4">
<scene title="Scene 1" number="1"/>
</chapter>
<chapter number="5">
<scene title="Scene 1" number="1"/>
</chapter>
<chapter number="6">
<scene title="Scene 1" number="1"/>
</chapter>
<chapter title="Epilogue">
<scene title="Scene 1" number="1"/>
</chapter>
</act>
</outline>
novel.hasSeries
Checks if the current Novel is part of a series.
novel.hasSeries ➜ Boolean
Return Values
Boolean | Will return true if the novel has a series, false otherwise. |
Examples
Checks if the current Novel is part of a series.
{novel.hasSeries}
true
novel.language
Returns the language of the current Novel.
novel.language ➜ Text
Return Values
Text | The language of the Novel, if available. |
Examples
Returns the language of the current Novel, the fallback will be ‘English’.
{novel.language}
English
novel.outline
Returns the full outline hierarchy of the current Novel, or the outline for the given arguments (e.g. Acts, POVs, ...).
novel.outline(...elements) ➜ Outline
Arguments
|
Return Values
Examples
Returns the full outline hierarchy of the current Novel, or the outline for the given arguments (e.g. Acts, POVs, …).
{novel.outline}
<outline>
<act title="Notes for New Users">
<chapter title="Introduction">
<scene title="Scene 1" number="1"/>
</chapter>
<chapter title="Legend">
<scene title="Scene 1" number="1"/>
</chapter>
<chapter title="Our Story">
<scene title="Scene 1" number="1"/>
</chapter>
</act>
<act number="1" title="The Giant Rat of Sumatra">
<chapter number="1">
<scene title="Scene 1" number="1"/>
</chapter>
<chapter number="2">
<scene title="Scene 1" number="1"/>
</chapter>
<chapter number="3">
<scene title="Scene 1" number="1"/>
</chapter>
<chapter number="4">
<scene title="Scene 1" number="1"/>
</chapter>
<chapter number="5">
<scene title="Scene 1" number="1"/>
</chapter>
<chapter number="6">
<scene title="Scene 1" number="1"/>
</chapter>
<chapter title="Epilogue">
<scene title="Scene 1" number="1"/>
</chapter>
</act>
</outline>
novel.tense
Returns the tense of the current Novel.
novel.tense ➜ Text
Return Values
Text | The tense of the Novel, if available. |
Examples
Returns the tense of the current Novel.
{novel.tense}
past tense
novel.title
Returns the title of the current Novel.
novel.title ➜ Text Container
Return Values
Text Container | Attributes
Reference
FormatPlain Text Contents will be rendered without any formatting/styles, preceded by the title (if any). |
Examples
Returns the title of the current Novel.
{novel.title}
My Awesome Novel
Other
date.today
Retrieves the current date in a human-readable format (e.g., "Monday, January 1, 2023").
date.today ➜ Text
Return Values
Text | The current date in a human-readable format. |
personas
Returns all available personas in the current context (based on the prompt type and the project(s) we're in).
personas ➜ List[Text Container]
Return Values
List | A list of text containers, each holding the content of the persona. FormatInherited The preferred rendering format is kept as is. Elements
|
Point Of View
pov
Extracts all available point of views from the given arguments (or the current scene if none are given).
pov(...elements) ➜ List[Point of View]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
pov.character
Extracts the character name from the given/current point of view(s).
pov.character(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
pov.isFirstPerson
Returns all given (or current) point of views that are first person.
pov.isFirstPerson(...elements) ➜ List[Point of View]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
pov.isLimited
Returns all given (or current) point of views that are considered to be 'limited'.
pov.isLimited(...elements) ➜ List[Point of View]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
pov.isOmniscient
Returns all given (or current) point of views that are considered to be 'omniscient'.
pov.isOmniscient(...elements) ➜ List[Point of View]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
pov.isOverwrite
Returns all given (or current) point of views that are not the same as the Novel default point of view.
pov.isOverwrite(...elements) ➜ List[Point of View]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
pov.isSecondPerson
Returns all given (or current) point of views that are second person.
pov.isSecondPerson(...elements) ➜ List[Point of View]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
pov.isThirdPerson
Returns all given (or current) point of views that are third person.
pov.isThirdPerson(...elements) ➜ List[Point of View]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
pov.type
Extracts the type of point of view from the given/current point of view(s).
pov.type(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
Prompts
prompt.model
Retrieves the full model name of the current prompt (as provided by your AI connection).
prompt.model ➜ Text
Return Values
Text | The full ID of the model that will be used to generate text. |
Examples
{prompt.model}
anthropic/claude-3.5-sonnet:beta
prompt.nsfw
Indicates whether the prompt is marked as a 'NSFW' (Not Safe For Work) prompt or not.
prompt.nsfw ➜ Boolean
Return Values
Scenes
isScene
Filters the given collection of items to only those that are an actual 'Scenes'.
isScene(...elements) ➜ List[Scene]
Arguments
|
Return Values
Examples
This function is a filter that can be used to filter mixed values, like those coming from input.
{isScene(input("Additional Context"))}
<outline>
<act title="Notes for New Users">
<chapter title="Legend">
<scene title="Scene 1" number="1"/>
</chapter>
</act>
</outline>
nextBeat
Retrieves the scene beat immediately following the current one (within the current scene).
nextBeat ➜ Text Container or Boolean
Return Values
Text Container | The scene beat immediately following the current one. FormatMarkdown The text will be rendered with Markdown formatting/styles, preceded by the title (if any). |
Boolean |
|
Examples
If a beat exists after the current point in the scene, this function will return it:
{nextBeat}
Sam walked down the pier and stopped to look at the water.
There were a couple sailboats in the distance, but one looked a bit odd.
You can also get the beat wrapped in XML by using the asXML
helper:
{asXML(nextBeat)}
<beat>
Sam walked down the pier and stopped to look at the water.
There were a couple sailboats in the distance, but one looked a bit odd.
</beat>
previousBeat
Retrieves the scene beat immediately preceding the current one (within the current scene).
previousBeat ➜ Text Container or Boolean
Return Values
Text Container | The scene beat immediately preceding the current one. FormatMarkdown The text will be rendered with Markdown formatting/styles, preceded by the title (if any). |
Boolean |
|
Examples
If a beat exists before the current point in the scene, this function will return it:
{previousBeat}
<beat>
Sam walked down the pier and stopped to look at the water.
There were a couple sailboats in the distance, but one looked a bit odd.
</beat>
You can also get the beat wrapped in XML by using the asXML
helper:
{asXML(previousBeat)}
<beat>
Sam walked down the pier and stopped to look at the water.
There were a couple sailboats in the distance, but one looked a bit odd.
</beat>
scene
Extracts all possible 'Scenes' from the given arguments. Defaults to the current Scene, if no arguments are given.
scene(...elements) ➜ List[Scene]
Arguments
|
Return Values
scene.fullText
Returns the full text/prose for each possible 'Scene' in the given arguments (or the current Scene if none are provided).
scene.fullText(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
scene.fullTitle
Extracts the full title of a Scene with chapter information for the given arguments.
scene.fullTitle(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
scene.hasLabel
Filters all Scenes in given arguments (or the current Scene if none are provided) by whether they have a label with the given name.
scene.hasLabel(...entries, labels) ➜ List[Scene]
Arguments
Entries |
| ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Labels |
|
Return Values
scene.hasMention
Filters all Scenes in given arguments (or the current Scene if none are provided) by whether they have a mention to the given Codex entry.
scene.hasMention(...entries, entries) ➜ List[Scene]
Arguments
Entries |
| ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Entries |
|
Return Values
scene.hasReference
Filters all Scenes in given arguments (or the current Scene if none are provided) by whether they have a reference to the given Codex entry.
scene.hasReference(...entries, entries) ➜ List[Scene]
Arguments
Entries |
| ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Entries |
|
Return Values
scene.hasSubtitle
Filters a collection of items, returning only those that have a subtitle.
scene.hasSubtitle(...elements) ➜ List[Scene]
Arguments
|
Return Values
scene.hasSummary
Filters a collection of items, returning only those that have a summary.
scene.hasSummary(...elements) ➜ List[Scene]
Arguments
|
Return Values
scene.hasText
Filters a collection of items, returning only those that have text content.
scene.hasText(...elements) ➜ List[Scene]
Arguments
|
Return Values
scene.labels
Returns the labels for each possible 'Scene' in the given arguments (or the current Scene if none are provided).
scene.labels(...elements) ➜ List[Label]
Arguments
|
Return Values
scene.next
Returns the immediately following 'Scene' for each possible 'Scene' in the given arguments (or the current Scene if none are provided).
scene.next(...elements) ➜ List[Scene]
Arguments
|
Return Values
scene.nextSamePOV
Returns the immediately following 'Scene' that shares the same Point of View for each possible 'Scene' in the given arguments (or the current Scene if none are provided).
scene.nextSamePOV(...elements) ➜ List[Scene]
Arguments
|
Return Values
scene.number
Returns the number for each possible 'Scene' in the given arguments (or the current Scene if none are provided).
scene.number(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | A list of text containers, each holding the number of a Scene. FormatInherited The preferred rendering format is kept as is. Elements
|
scene.previous
Returns the immediately preceding 'Scene' for each possible 'Scene' in the given arguments (or the current Scene if none are provided).
scene.previous(...elements) ➜ List[Scene]
Arguments
|
Return Values
scene.previousSamePOV
Returns the immediately preceding 'Scene' that shares the same Point of View for each possible 'Scene' in the given arguments (or the current Scene if none are provided).
scene.previousSamePOV(...elements) ➜ List[Scene]
Arguments
|
Return Values
scene.references
Returns the references for each possible 'Scene' in the given arguments (or the current Scene if none are provided).
scene.references(...elements) ➜ List[Codex Entry]
Arguments
|
Return Values
List | A list of codexEntries the scene has a reference to. FormatInherited The preferred rendering format is kept as is. Elements
|
scene.subtitle
Extracts the subtitle of a Scene for the given arguments.
scene.subtitle(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
scene.summary
Returns the scene summaries for each possible 'Scene' in the given arguments (or the current Scene if none are provided).
scene.summary(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
scene.title
Extracts the title of a Scene for the given arguments.
scene.title(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | FormatInherited The preferred rendering format is kept as is. Elements
|
Series
series
Retrieves the Series object to which the current novel belongs, if any.
series ➜ Series
Return Values
Series | The <series /> tag with title attribute and it's description as content. |
Examples
Retrieves the Series object to which the current novel belongs, if any.
{series}
<series title="The Epic Trilogy">
A grand adventure across three books.
</series>
series.description
Extract the description of the Series to which the current novel belongs, if any.
series.description ➜ Text Container
Return Values
Text Container | Attributes
Reference
FormatPlain Text Contents will be rendered without any formatting/styles, preceded by the title (if any). |
Examples
Extracts the description of the Series to which the current novel belongs, if any.
{series.description}
The Epic Trilogy: A grand adventure across three books.
series.title
Extract the title of the Series to which the current novel belongs, if any.
series.title ➜ Text Container
Return Values
Text Container | Attributes
Reference
FormatPlain Text Contents will be rendered without any formatting/styles, preceded by the title (if any). |
Examples
Extracts the title of the Series to which the current novel belongs, if any.
{series.title}
The Epic Trilogy
Snippets
snippets.get
Retrieves one or more Snippets by their name or extracts them from the given arguments.
snippets.get(...elements) ➜ List[Snippet]
Arguments
|
snippets.has
Checks if the given arguments contain any (valid) Snippets.
snippets.has(...elements) ➜ Boolean
Arguments
|
Return Values
Boolean | Returns true/false whether any of the given arguments are valid snippets. |
Text
asList
Converts each given argument to a text container and renders them as a bulleted list.
asList(...elements) ➜ Text
Arguments
|
Return Values
Text | The given arguments rendered as bulleted list. |
asMarkdown
Renders each given argument as Markdown (nested elements will use increasing heading levels).
asMarkdown(...elements) ➜ Text
Arguments
|
Return Values
Text | The given arguments rendered as markdown. |
asNumberedList
Converts each given argument to a text container and renders them as a numbered list.
asNumberedList(...elements) ➜ Text
Arguments
|
Return Values
Text | The given arguments rendered as numbered list. |
asPlainText
Renders each given argument as regular plain text.
asPlainText(...elements) ➜ Text
Arguments
|
Return Values
Text | The given arguments rendered as plain text. |
asXml
Renders each given argument as (nested) XML.
asXml(...elements) ➜ Text
Arguments
|
Return Values
Text | The given arguments rendered as (nested) XML. |
content
Extracts the text content of the given arguments.
content(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | A list of text containers, each holding the text content of an element. FormatInherited The preferred rendering format is kept as is. Elements
|
firstWords
Returns the first N number of words for the given text elements, excluding any titles or attributes.
firstWords(...entries, number) ➜ List[Text Container]
Arguments
Return Values
List | The elements converted to textContainers, excluding any titles or attributes, with the first N words of each element. FormatInherited The preferred rendering format is kept as is. Elements
|
lastWords
Returns the last N number of words for the given text elements, excluding any titles or attributes.
lastWords(...entries, number) ➜ List[Text Container]
Arguments
Return Values
List | The elements converted to textContainers, excluding any titles or attributes, with the last N words of each element. FormatInherited The preferred rendering format is kept as is. Elements
|
lowercase
Transforms a text into all lowercase letters.
lowercase(...elements) ➜ List[Any Type]
Arguments
|
Return Values
pluralize
Returns a text with the count in front and the correct singular/plural form based on that count.
pluralize(...elements) ➜ Text
Arguments
Elements |
| ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Elements |
| ||||||||||||||||||||||||||||||
Elements |
|
Return Values
Text | The count in front of the singular/plural form of the word. The singular form is used if the count is 1, otherwise the plural form is used. |
Examples
If you want to pluralize for example “character” for your prompt based on the number of characters in your current context, you can use the following code:
{pluralize(count(codex.characters), "character", "characters")}
removePunctuation
Removes all punctuation from a text.
removePunctuation(...elements) ➜ List[Any Type]
Arguments
|
Return Values
removeWhitespace
Removes all whitespace from a text.
removeWhitespace(...elements) ➜ List[Any Type]
Arguments
|
Return Values
title
Extracts the title of the given arguments.
title(...elements) ➜ List[Text Container]
Arguments
|
Return Values
List | A list of text containers, each holding the title of an element. FormatInherited The preferred rendering format is kept as is. Elements
|
uppercase
Transforms a text into all capital letters.
uppercase(...elements) ➜ List[Any Type]
Arguments
|
Return Values
wordCount
Converts all arguments to text and count the number of total words in the text across all arguments.
wordCount(...elements) ➜ Number
Arguments
|
Return Values
Number | The total number of words in all given arguments. |
wordsAfter
Returns the last N words of the text after the current message, up to the nearest boundary.
wordsAfter(...elements) ➜ Text
Arguments
|
Return Values
Text | The last N words of the text after (or the whole text after if the number was ommited) the current message, up to the nearest boundary. |
wordsBefore
Returns the last N words of the text before the current message, up to the nearest boundary.
wordsBefore(...elements) ➜ Text
Arguments
|
Return Values
Text | The last N words of the text before (or the whole text before if the number was ommited) the current message, up to the nearest boundary. |