esnya / bcdice-js

[DEPRECATED] BCDice for JavaScript (Browser/Node.js)
MIT License
12 stars 3 forks source link
bcdice bcdice-js dice-rolls javascript tabletop-rpgs

!!DEPRECATED!!

Please use https://www.npmjs.com/package/bcdice

bcdice-js

npm package Build Status Coverage Status DevDependencies

BCDice for JavaScript (Browser/Node.js). Transpiled by Opal.

Examples

Usage

  1. Install

    $ npm install --save bcdice-js
  2. Import

    import BCDice from 'bcdice-js'; // ES Modules
    // or
    const BCDice = require('bcdice-js').BCDice; // CommonJS
  3. Preload dicebots (Only on the browser!!)

    import 'bcdice-js/lib/preload-dicebots';
    // or
    require('bcdice-js/lib/preload-dicebots');
  4. Create BCDice instance

    const bcdice = new BCDice();
  5. Set dicebot

    bcdice.setGameByTitle('SwordWorld2_0'); // Default: 'DiceBot'
  6. Set message and execute

    bcdice.setMessage('2d');
    console.log(bcdice.dice_command());

Contribution

License

MIT License

Changelog

CHANGELOG.md