FiftyFiftyParser
Render the payload half the time, and nothing the other half.
5050 renders its payload on a coin flip. The other half of the time it renders nothing at all.
For template authors
Syntax
{5050:message}Examples
Hello!{5050: Nice to see you again.}
# Hello! Nice to see you again.
# Hello!Because the tag renders an empty string on a miss, comparing it against empty gives you a plain coin flip:
I pick {if({5050:.}!=):heads|tails}
# I pick heads
# I pick tailsAliases
5050, 50, ?
For developers
Register the parser
import { Interpreter, FiftyFiftyParser } from 'tagscript';
const ts = new Interpreter(new FiftyFiftyParser());Behaviour
The payload is required and no parameter is used. parse picks between '' and the payload with Math.random(), so the odds are an even split and not configurable. For other odds, compare a range roll with if.
API reference
Last updated on