System-wide Replacement Macros (in order of evaluation):
- {{pipe}} – only for slash command batching. Replaced with the returned result of the previous command.
- {{newline}} – just inserts a newline.
- {{trim}} – trims newlines surrounding this macro.
- {{noop}} – no operation, just an empty string.
- {{original}} – global prompts defined in API settings. Only valid in Advanced Definitions prompt overrides.
- {{input}} – the user input
- {{charPrompt}} – the Character's Main Prompt override
- {{charJailbreak}} – the Character's Jailbreak Prompt override
- {{description}} – the Character's Description
- {{personality}} – the Character's Personality
- {{scenario}} – the Character's Scenario
- {{persona}} – your current Persona Description
- {{mesExamples}} – the Character's Dialogue Examples
- {{mesExamplesRaw}} – unformatted Dialogue Examples (only for Story String)
- {{summary}} – the latest chat summary generated by the "Summarize" extension (if available).
- {{user}} – your current Persona username
- {{char}} – the Character's name
- {{char_version}} – the Character's version number
- {{group}} – a comma-separated list of group member names or the character name in solo chats. Alias: {{charIfNotGroup}}
- {{model}} – a text generation model name for the currently selected API. Can be inaccurate!
- {{lastMessage}} – the text of the latest chat message.
- {{lastUserMessage}} – the text of the latest user chat message.
- {{lastCharMessage}} – the text of the latest character chat message.
- {{lastMessageId}} – index # of the latest chat message. Useful for slash command batching.
- {{firstIncludedMessageId}} – the ID of the first message included in the context. Requires generation to be ran at least once in the current session.
- {{currentSwipeId}} – the 1-based ID of the current swipe in the last chat message. Empty string if the last message is user or prompt-hidden.
- {{lastSwipeId}} – the number of swipes in the last chat message. Empty string if the last message is user or prompt-hidden.
- {{reverse:(content)}} – reverses the content of the macro.
- {{// (note)}} – you can leave a note here, and the macro will be replaced with blank content. Not visible for the AI.
- {{time}} – the current time
- {{date}} – the current date
- {{weekday}} – the current weekday
- {{isotime}} – the current ISO time (24-hour clock)
- {{isodate}} – the current ISO date (YYYY-MM-DD)
- {{datetimeformat …}} – the current date/time in the specified format, e. g. for German date/time: {{datetimeformat DD.MM.YYYY HH:mm}}
- {{time_UTC±#}} – the current time in the specified UTC time zone offset, e.g. UTC-4 or UTC+2
- {{timeDiff::(time1)::(time2)}} – the time difference between time1 and time2. Accepts time and date macros. (Ex: {{timeDiff::{{isodate}} {{time}}::2024/5/11 12:30:00}})
- {{idle_duration}} – the time since the last user message was sent
- {{bias "text here"}} – sets a behavioral bias for the AI until the next user input. Quotes around the text are important.
- {{roll:(formula)}} – rolls a dice. (ex: {{roll:1d6}} will roll a 6-sided dice and return a number between 1 and 6)
- {{random:(args)}} – returns a random item from the list. (ex: {{random:1,2,3,4}} will return 1 of the 4 numbers at random. Works with text lists too.
- {{random::(arg1)::(arg2)}} – alternative syntax for random that allows to use commas in the list items.
- {{pick::(args)}} – picks a random item from the list. Works the same as {{random}}, with the same possible syntax options, but the pick will stay consistent for this chat once picked and won't be re-rolled on consecutive messages and prompt processing.
- {{banned "text here"}} – dynamically add text in the quotes to banned words sequences, if Text Generation WebUI backend used. Do nothing for others backends. Can be used anywhere (Character description, WI, AN, etc.) Quotes around the text are important.
Instruct Mode and Context Template Macros:
(enabled in the Advanced Formatting settings)
- {{maxPrompt}} – max allowed prompt length in tokens = (context size - response length)
- {{exampleSeparator}} – context template example dialogues separator
- {{chatStart}} – context template chat start line
- {{systemPrompt}} – system prompt content if enabled (either character prompt override if allowed, or defaultSystemPrompt)
- {{defaultSystemPrompt}} – system prompt content
- {{instructSystemPromptPrefix}} – instruct system prompt prefix sequence
- {{instructSystemPromptSuffix}} – instruct system prompt suffix sequence
- {{instructUserPrefix}} – instruct user prefix sequence
- {{instructUserSuffix}} – instruct user suffix sequence
- {{instructAssistantPrefix}} – instruct assistant prefix sequence
- {{instructAssistantSuffix}} – instruct assistant suffix sequence
- {{instructFirstAssistantPrefix}} – instruct assistant first output sequence
- {{instructLastAssistantPrefix}} – instruct assistant last output sequence
- {{instructSystemPrefix}} – instruct system message prefix sequence
- {{instructSystemSuffix}} – instruct system message suffix sequence
- {{instructSystemInstructionPrefix}} – instruct system instruction prefix
- {{instructUserFiller}} – instruct first user message filler
- {{instructStop}} – instruct stop sequence
- {{instructFirstUserPrefix}} – instruct user first input sequence
- {{instructLastUserPrefix}} – instruct user last input sequence
Chat variables Macros:
Local variables = unique to the current chat
Global variables = works in any chat for any character
Scoped variables = works in STscript
- {{getvar::name}} – replaced with the value of the local variable "name"
- {{setvar::name::value}} – replaced with empty string, sets the local variable "name" to "value"
- {{addvar::name::increment}} – replaced with empty strings, adds a numeric value of "increment" to the local variable "name"
- {{incvar::name}} – replaced with the result of the increment of value of the variable "name" by 1
- {{decvar::name}} – replaced with the result of the decrement of value of the variable "name" by 1
- {{getglobalvar::name}} – replaced with the value of the global variable "name"
- {{setglobalvar::name::value}} – replaced with empty string, sets the global variable "name" to "value"
- {{addglobalvar::name::value}} – replaced with empty string, adds a numeric value of "increment" to the global variable "name"
- {{incglobalvar::name}} – replaced with the result of the increment of value of the global variable "name" by 1
- {{decglobalvar::name}} – replaced with the result of the decrement of value of the global variable "name" by 1
- {{var::name}} – replaced with the value of the scoped variable "name"
- {{var::name::index}} – replaced with the value of item at index (for arrays / lists or objects / dictionaries) of the scoped variable "name"