Skip to content
A CLI dice roller
D
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
roll.d

README.md

roll

Introduction

roll is a very simple command-line dice roller written in D. It can throw any number of any type of dice, add modifiers, ace (explode) the rolls, make several independant rolls in one call, etc.

I wrote it a long time ago to try some D language and use it with Savage Worlds. Now I release the code to anyone who may want to use it.

Usage

roll [{a|d}[+{{a|d}|modifier}]+]+

As you can see, it uses any number of clauses separated by spaces, each of this is composed of:

  • n: an integer, saying how many dices to roll
  • d|a: d indicates a normal roll, a an exploding roll (where, if the die shows its biggest face, it is rerolled and both values added)
  • die: the value of the di(c)e to roll. Usually 4,6,8,10,12 or 20, but it can be any positive integer.
  • modifier: An integer to add (or substract) to the final result

Examples

  • roll 2d6+1d4

Rolls two 6-sided dice, one 4-sided die, and adds the three results

  • roll 1d12 2d8-2

Rolls one 12-sided die, show its result, then roll two 8-sided dice, add them, substract 2, and show the result.

You can’t perform that action at this time.