Stringalong

Grammar-based random text generator — a tgies creation based on Orteil's RandomGen

Source

Output

DSL Reference

Metadata

Lines starting with $ set generator options:

$name : My Generator
$author : Your Name
$description : What it does
$picture : url/to/image
$button : Roll!
$amount : 5
$seed text : Enter a name:

Directives

Special commands:

$force unique      prevent repeats
$allow duplicates  allow repeats
$all roots         all lists in dropdown
$weighted chances  weighted chance model
$include file.txt  load external file

Comments: // line, /* block */, $[note]

Lists

Define lists with $listname. Lines after become items:

$color
red
blue
green
  • $list > — mark as root (UI dropdown)
  • $+list — append to existing list

Item Attributes

Items can have metadata in {} at end:

$pet
cat {plural:cats}{sound:meow}
dog {plural:dogs}{sound:woof}
unicorn {5%}{sound:neigh}
  • {key:value} — named attribute

Chance (Filter Mode)

Items can have a {N%} tag to control how likely they are to be picked.

Filter mode is the default: each item independently rolls against its chance to enter the candidate pool. Untagged items always pass. One item is then picked uniformly from the pool.

$loot
sword
shield
diamond sword {20%}

Chance (Weighted Mode)

Enable with $weighted chances. Chance values become proportional weights. {60%} = 60% of picks. Untagged items split the remainder equally.

$creature
common {60%}
uncommon {30%}
rare {10%}

Basic Tags

Tags expand content using [] brackets:

[color]         pick from $color
[a|b|c]         inline random choice
[1-100]         random integer
[-50-50]        negative ranges ok
[/]             line break (<br>)
[ ]             literal space

Variables

Store and recall values with #id:

[pet, #p]       store pick as 'p'
[#p]            recall stored value
[#p, as sound]  get attribute
[#x, or ???]    fallback if missing
[*CLEAR*]       clear all stored IDs

Attribute Access

Use as to get item attributes:

[pet, #p, as sound]  get sound attr
[#p, as plural]      from stored item
[#p, as #key]        dynamic attr name
[thing, as x, or ?]  with fallback

Repeat Modifier

Repeat expansion with x:

[word, x3]      repeat 3 times
[word, x2-5]    repeat 2-5 times
[a|b|c, x4]     4 random choices

Casing Modifiers

Control text capitalization:

[list, title]   Title Case
[list, upper]   UPPERCASE
[list, lower]   lowercase

Auto-matching: if tag is capitalized, output matches. [Color]Red

Uniqueness

Control repeat prevention per-pick:

[list, unique]  force unique pick
[list, mundane] allow repeats

Global default set by $force unique / $allow duplicates.

Text Processing

Slice and compress text:

[word, first part]   first third
[word, middle part]  middle third
[word, last part]    last third
[word, compress]     remove spaces
[word, hidden]       evaluate, output ""

Written Modifier

Store final string instead of item object:

[pet, #p, written]

Useful when you need the rendered text including casing, not the raw item for later attribute access.

Template Params

Pass values into templates with %n:

$greet
Hello, %1! You have %2 coins.

$output >
[greet, %Alice, %100]

→ "Hello, Alice! You have 100 coins."

Each (Iteration)

Process text character-by-character:

$sep
 _
/

$glitch
[_]
[_]
[_][sep]

$output >
[word, upper, each glitch]

Each char is set as the [_] list, then the target list is evaluated. Use to build per-character effects like text fragmentation.

Smart Grammar

Automatic a/an and pluralization:

[a] cat       → "a cat"
[an] apple    → "an apple"
[a] [animal]  → "a dog" or "an owl"
cat[s]        → "cats"
[pet][s]      → "dogs"

Case-aware: [A]A/An

Special Tags

Built-in meta references:

[seed]          current seed value
[game's name]   $name value
[author's name] $author value