You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Usage/macros.md
+93-5Lines changed: 93 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,23 @@ Macros are dynamic placeholders that get replaced with actual values when text i
18
18
SillyTavern provides built-in documentation for all available macros:
19
19
20
20
-**Slash command**: Type `/? macros` in the chat input to display a list of all registered macros with their descriptions.
21
-
-**Autocomplete**: Type `{{` during slash commands autocomplete in the input field to get suggestions for available macros.
21
+
-**Autocomplete**: See [Macro Autocomplete](#macro-autocomplete) below for details on getting suggestions while typing.
22
+
23
+
### Macro Autocomplete
24
+
25
+
Macro autocomplete provides suggestions for available macros as you type. It works in all text fields that support macros throughout SillyTavern.
26
+
27
+
Type `{{` to start autocomplete for macros, showing available macros and their arguments, potential [Macro Flags](#macro-flags), [Variable Shorthands](#variable-shorthands), and more.
28
+
29
+
**Where autocomplete appears by default:**
30
+
31
+
- Expanded editor (full-screen text editing, opened via the 'Expand' button next to text fields)
32
+
- Prompt manager editor
33
+
34
+
**Triggering autocomplete in other fields:**
35
+
36
+
- Press **Ctrl+Space** in any macro-supporting text field to open the autocomplete popup
37
+
- Enable **Settings → AutoComplete Settings → Show in all macro fields** to have autocomplete appear automatically in all macro fields
22
38
23
39
## Basic Syntax
24
40
@@ -217,7 +233,7 @@ The condition can be:
217
233
218
234
- A macro name (resolved automatically if no arguments are required)
219
235
- Any value from a nested macro like `{{getvar::flag}}`
220
-
- A variable shorthand like `.myFlag` or `$globalFlag` (see [Variable Shorthand Syntax](#variable-shorthand-syntax))
236
+
- A variable shorthand like `.myFlag` or `$globalFlag` (see [Variable Shorthands](#variable-shorthands))
221
237
- Any text you want (that will implicitly resolve to truthy or falsy based on its content)
@@ -236,7 +252,7 @@ Variable shorthands provide a concise way to check variable values in conditions
236
252
{{ /if }}
237
253
```
238
254
239
-
See [Variable Shorthand Syntax](#variable-shorthand-syntax) for more details on shorthand notation.
255
+
See [Variable Shorthands](#variable-shorthands) for more details on shorthand notation.
240
256
241
257
### Inverted Condition
242
258
@@ -318,7 +334,7 @@ Whitespace is allowed between flags and the macro name:
318
334
### Flags-like prefix operators
319
335
320
336
Variable shorthand syntax uses prefix operators (`.` and `$`) which behave similarly to flags but are not flags themselves.
321
-
See the [Variable Shorthand Syntax](#variable-shorthand-syntax) section for details.
337
+
See the [Variable Shorthands](#variable-shorthands) section for details.
322
338
323
339
### Preserve Whitespace Flag
324
340
@@ -361,7 +377,7 @@ To display literal curly braces without macro resolution, escape them with backs
361
377
362
378
This outputs `{{notAMacro}}` as plain text.
363
379
364
-
## Variable Shorthand Syntax
380
+
## Variable Shorthands
365
381
366
382
!!!warning Staging Feature
367
383
This is currently only available on the `staging` branch of SillyTavern, and not part of the latest release.
@@ -427,6 +443,10 @@ The following operators can be used with variable shorthands. Each operator foll
427
443
|`??=`|[Nullish Coalescing Assign](#nullish-coalescing-assign)|`{{.name ??= Guest}}`| Sets value only if variable is undefined, returns the new value |
428
444
|`==`|[Equals](#equals)|`{{.status == active}}`| Compares values, returns `"true"` or `"false"`|
429
445
|`!=`|[Not Equals](#not-equals)|`{{.status != active}}`| Compares values, returns `"true"` if not equal |
446
+
|`>`|[Greater Than](#greater-than)|`{{.score > 50}}`| Returns `"true"` if variable is greater than value |
447
+
|`>=`|[Greater Than or Equal](#greater-than-or-equal)|`{{.level >= 10}}`| Returns `"true"` if variable is greater than or equal to value |
448
+
|`<`|[Less Than](#less-than)|`{{.health < 20}}`| Returns `"true"` if variable is less than value |
449
+
|`<=`|[Less Than or Equal](#less-than-or-equal)|`{{.health <= 0}}`| Returns `"true"` if variable is less than or equal to value |
430
450
431
451
#### Get Variable
432
452
@@ -582,6 +602,74 @@ Useful in `{{if}}` conditions:
0 commit comments