Tagscript

RandomParser

The random tag picks a random item from a list of strings, split by either ~ or ,. This parser is useful for selecting random messages, responses, or values from a predefined list.

Usage

import { Interpreter, RandomParser } from 'tagscript';
const ts = new Interpreter(new RandomParser());
const { Interpreter, RandomParser } = require('tagscript');
const ts = new Interpreter(new RandomParser());

API

Check RandomParser for the API documentation.

For End Users

Syntax

{random:item1,item2,item3}
{random:item1~item2~item3}

Examples

{random:foo, bar, baz}
# foo
# bar
# baz
{random:Hello, Hi, Hey} there!
# Hello there!
# Hi there!
# Hey there!
{random:apple~banana~cherry~date}
# apple
# banana
# cherry
# date

Aliases

rand

Last updated on