No description
  • TypeScript 88.2%
  • CSS 11.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
SrJuggernaut bb7ac8f919 feat(macro): add randpick macro for random selection with optional weights
Register the `randpick` macro via `setupPickMacro()` in the pick service,
reusing the existing `pickFromOptions()` logic. Supports uniform and
weighted random selection with the same syntax as the %%pick%% placeholder.

Also fix README: correct casing for randomWord/shuffle macros and
mark shuffle as macro-capable instead of placeholder-only.
2026-08-08 13:31:07 -06:00
.husky chore: initial repo config 2025-08-12 12:24:49 -06:00
.vscode chore: update dependencies 2026-04-16 12:33:41 -06:00
dist feat(macro): add randpick macro for random selection with optional weights 2026-08-08 13:31:07 -06:00
src feat(macro): add randpick macro for random selection with optional weights 2026-08-08 13:31:07 -06:00
types feat: build system 2025-08-13 12:21:20 -06:00
.gitignore chore: initial repo config 2025-08-12 12:24:49 -06:00
.lintstagedrc.json chore: initial repo config 2025-08-12 12:24:49 -06:00
biome.json chore: update dependencies 2026-04-16 12:33:41 -06:00
bun.lock chore(pick): add unit tests for services 2026-08-08 13:18:24 -06:00
commitlint.config.ts feat: build system 2025-08-13 12:21:20 -06:00
manifest.json feat: build system 2025-08-13 12:21:20 -06:00
package.json chore(pick): add unit tests for services 2026-08-08 13:18:24 -06:00
README.md feat(macro): add randpick macro for random selection with optional weights 2026-08-08 13:31:07 -06:00
tsconfig.json chore(pick): add unit tests for services 2026-08-08 13:18:24 -06:00

st-randomness-helpers

st-randomness-helpers is a extension for SillyTavern.

Features

WordLists

WordList are plaintext files containing one or more words per line. The name of the file is the name of the WordList.

Macros

Register macros that are usually replaced with a value at save time.

Placeholders

Placeholders are strings that are replaced with a value at generation time.

Slash Commands

Register slash commands that are used for scripting.

/replaceRandom (alias: /randomReplace)

Replace placeholders in the provided text with random values. This command processes all supported placeholder types in a single operation. Example: /replaceRandom I have a %%randomWord::PetSpecies%% myself

Services

RandomWord

Get a random word from a WordList. Can be used as a Macro or a Placeholder. Macro format: {{randomWord::WordListName}}. Placeholder format: %%randomWord::WordListName%%.

Shuffle

Shuffle a list of values. Can be used as a Macro or a Placeholder. Macro format: {{shuffle::Value1::Value2::Value3;;separator}}. Placeholder format: %%shuffle::Value1::Value2::Value3;;separator%%. Example: %%shuffle::Value1::Value2::Value3;;, %% will return Value3, Value1, Value2.

Pick

Pick a random value from a list of values. Can be used as a Macro or a Placeholder.

  • Macro format: {{randpick::Value1::Value2::Value3}}
  • Placeholder format: %%pick::Value1::Value2::Value3%%

Example: %%pick::Red::Blue::Green%% will return one of Red, Blue, or Green randomly.

Uniform Pick (default)

When no weights are specified, all options have an equal chance of being chosen.

Macro: {{randpick::Option1::Option2::Option3}} Placeholder: %%pick::Option1::Option2::Option3%%

Example: %%pick::Red::Blue::Green%% → each color has a 33.3% chance.

Weighted Pick

You can assign proportional weights to options using the weight;;value syntax. The probability of each option is weight / totalWeight.

Macro: {{randpick::<weight>;;<value>::<weight>;;<value>::...}} Placeholder: %%pick::<weight>;;<value>::<weight>;;<value>::...%%

Example: %%pick::5;;Red::3;;Blue::2;;Green%% → Red has 50% chance, Blue 30%, Green 20% (total weight = 10).

Rules:

  • Options without a valid weight (or without ;;) default to weight 1.
  • Options with weight 0 or negative are excluded from the selection.
  • If no valid weighted options remain after filtering, the result is an empty string.
  • Mixing weighted and unweighted options is supported—unweighted options get weight 1. For example: %%pick::5;;Common::Rare::5;;Legendary%%Common and Legendary each have 5/11 ≈ 45.5% chance, Rare has 1/11 ≈ 9.1% chance.