Skip to content

Prompt Functions

Inside the prompt instructions, you can call functions that Novelcrafter provides you with. Use the following syntax to call a function:

{some.function_name(argument1, argument2, ...)}

  • Arguments that take a text (string) have to be surrounded by quotes, like this: "some text".
  • Arguments that take a number (integer) have to be written as is, like this: 123.

Logic Gates / Branching

Like in programming, you can use logic gates, or branching, to create more complex prompts. The following logic gates are available:

  • {#if(condition)} - If the condition is true, the following text will be included in the prompt.
  • {#elseif(condition)} - If the previous if condition was false, and this condition is true, the following text will be included in the prompt.
  • {#else} - If the previous if condition was false, the following text will be included in the prompt.
  • {#endif} - Ends the previous if condition.

Series

series.title

Returns the title of the associated series (if any).

series.description

Returns the description of the associated series (if any).

Novel

novel.tense

Returns the tense of the current novel. Either “past” or “present”.

novel.language

Returns the language of the current novel.

novel.pov

Returns the point of view of the current novel.

novel.hasSeries

Returns true if the novel is associated with a series, otherwise nothing.

novel.outline

Returns the full outline of the current novel (in markdown format). Even those marked as “excluded from AI”.

novel.fullText

Returns the full text of the current novel (in plaintext format). Includes all scenes, even those marked as “excluded from AI”.

Snippets

snippets.get(title: string)

Returns the text of the snippet with the given title.

Current Scene

args.scene

Returns the exact ID of the current scene, if there is one in the context.

scene.title

Returns the title of the current scene (full chapter title and scene number).

scene.summary

Returns the summary of the current scene.

scene.content

Returns the content of the current scene (in plaintext format).

scene.pov

Returns the point of view of the scene novel.

Context Data

context.storySoFar

The story contents so far (based on scene summaries).

context.chapterSoFar

The story contents inside the current chapter so far (based on scene summaries).

context.sceneSoFar

The story contents until the point where the prompt gets executed (in scene beats).

context.wordsBefore(words: number)

Last N number of words of the current scene contents before the selection.

context.previousScene.lastWords(words: number)

Last N number of words of the contents of the scene prior to the current one.

Codex

All codex entries return the name, potential aliases/nicknames and the description of the entry.

codex.get(title: string)

Returns the description of the codex entry with the given title (in plain text).

context.codex(format: string)

Returns the full list of detected codex entries in the current context (in the desired format: xml or raw for plain text).

context.codex.characters(format: string)

Returns the full list of detected characters in the current context (in the desired format: xml or raw for plain text).

context.codex.locations(format: string)

Returns the full list of detected locations in the current context (in the desired format: xml or raw for plain text).

context.codex.objects(format: string)

Returns the full list of detected objects in the current context (in the desired format: xml or raw for plain text).

context.codex.lore(format: string)

Returns the full list of detected lore in the current context (in the desired format: xml or raw for plain text).

context.codex.other(format: string)

Returns the full list of detected other codex entries in the current context (in the desired format: xml or raw for plain text).

context.codex.get(title: string)

Returns the description of the codex entry with the given title (in plain text). This also includes all the codex additions up til the point where the prompt gets executed inside the scene.

Utilities

string.compress(text: string)

Compresses the given string by removing punctiation and whitespace (Rarely used).