FiftyFiftyParser
The fifty-fifty tag has a 50% chance of returning the payload, and a 50% chance of returning an empty string. This parser is useful for creating random events or decisions with equal probability.
Usage
import { Interpreter, FiftyFiftyParser } from 'tagscript';
const ts = new Interpreter(new FiftyFiftyParser());
const { Interpreter, FiftyFiftyParser } = require('tagscript');
const ts = new Interpreter(new FiftyFiftyParser());
API
Check FiftyFiftyParser for the API documentation.
For End Users
Syntax
{5050:message}
{50:message}
{?:message}
Examples
{5050:You got lucky!}
# 50% chance: You got lucky!
# 50% chance: (empty string)
I pick {if({5050:.}!=):heads|tails}
# 50% chance: I pick heads
# 50% chance: I pick tails
{?:Rare event occurred!} Welcome to the server!
# 50% chance: Rare event occurred! Welcome to the server!
# 50% chance: Welcome to the server!
Aliases
5050
, 50
, ?
Last updated on