DiceRoller API Documentation

website·Indexed 31 days ago

https://dice-roller.github.io/documentation/

A library for handling dice rolling functionality, including support for various dice types like StandardDice, PercentileDice, and FudgeDice. It features a comprehensive system for dice notations, roll history, and modifiers such as KeepModifier, DropModifier, ExplodeModifier, and CriticalSuccessModifier. The documentation covers API references for RollResults, custom random number generators, and a CLI for direct command-line usage.

Tokens
22.9K
Snippets
150
Records
234
Agent score
73%

What's inside DiceRoller

  1. Overview of the JS Dice Roller library

    This library is a JavaScript-based dice roller designed for pen and paper / tabletop RPGs (such as Dungeons & Dragons, Pathfinder, Cyberpunk, and Warhammer). It allows users to roll various types of dice, apply modifiers, and evaluate mathematical equations using string-based "notations".
  2. Parse dice notation strings using the Parser class

    The Parser is a global class that takes a dice notation string and parses it into a list of dice and modifier objects. While it is used internally by the DiceRoll object, it can be used independently to validate or decompose notation strings.
  3. Understand dice-roller notation basics

    Dice-roller uses 'notations'—simple strings of characters—to define which dice to roll and which modifiers to apply. The system is based on standard Dice Notation (as defined on Wikipedia) but is enhanced with additional functionality for complex rolls, such as exploding dice, re-rolls, and mathematical equations.
  4. Use the HasDescription abstract class for description functionality

    HasDescription is a global abstract class that serves as a base for providing description functionality. It should not be instantiated directly; instead, developers should use one of its extended classes or extend it to create a custom class that requires a description.
  5. Use ExplodeModifier to implement exploding dice

    The ExplodeModifier is a global class that extends ComparisonModifier. It re-rolls dice that match a given test (defined by a ComparePoint) and adds the new results to the existing roll results. If you need to replace the original value with the new roll instead of adding to it, use ReRollModifier instead.