Simple eventful dice for rpg or any dicegame.
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
index.js
package.json

README.md

rpgdice

by: ok 2012

Simple eventful dice for rpg or any dicegame.

Designed to support multiple games and players using the same dice, for example in multiple socket.io rooms.

Usage

Install the module: npm install rpgdice

Require the module: var dice = require('rpgdice');

Roll the dice: dice.roll('1d6+4', 'player1', 'game1')

  • the dice must be in the form of rolls d sides
  • the modifier (+4 etc.), the playername and the gamename can be omitted*

events

dice.on(' event ', function ( args ) {});

'rolling', dice, roller, game

when a player rolls

  • dice string
  • roller string
  • game string

'roll', roll, roller, game

when a single dice rolls

  • roll string
  • roller string
  • game string

'result', dice, rolls, result, roller, game

when all the dice have been rolled

  • dice string
  • rolls array
  • result number
  • roller string
  • game string

'misroll', error, roller, game

if the dice was malformed or other errors occur

  • error error
  • roller string
  • game string

License

MIT: http://ok.mit-license.org/