KDiceGen
==============
An advanced scriptable dungeon and dragons style dice roller.
Features
==============
- Functionaly can be extended by writing simple scripts
- Easily store and roll any number of different dice/configurations
Notes
==============
This is an alpha release version and is missing a lot of the functionalty that
is planned for the final release.
Install
==============
mkdir build
cd build
cmake ..
make
sudo make install
Dice
==============
The dice are simple javascripts defined as follows:
The script must have an object where all the values are set
The object must contain the following properties:
- name
the default name/label of the dice
- version
the version of the dice (not currently used)
- type
the type of the dice (used to identify the script)
- values
an array containing the default values for the dice
- run
a function to be called when the script is run and returns a string
containing a textual reprensation fo the result (that will be displayed to
the user)
- description
a function that returns a scring describing the dice (it should present the
currently stored values in a useful way to the user)
Any other functions or varibles can also be used.
The scripts are supplied a varible called dice that contains an instance of the
dice to which the script is attached. Using this the script has access to the
propertites of the dice including:
- dice.name
the name of the dice set by the user
- dice.type
the type of the dice (should be the same as the type set by the script)
- dice.values
the current values of the dice
- dice.roll(sides)
rolls a dice with sides faces, logs and returns the result
- dice.roll(sides, number)
rolls number amount of dices with sides faces and return a list of the
results
- dice.formatRolls(rolllist, mod, format)
returns a string format with placeholders replaces by values
%t indicates the total of the rolllist + the mod
%l is replaced by a + seperated list of the rolls
%m is replaced by either '+ mod' or '- mod' or nothing if mod is 0
Example scripts can be found in src/dice/
Scripts are loaded from two places, either compiled into the executable or in
the applications data directory for each user (located at
$HOME/.local/data/KDiceGen/dice on unix).