Merge lp://staging/~andrenasturas/synapse-project/rolldice-plugin into lp://staging/synapse-project

Proposed by André Nasturas
Status: Needs review
Proposed branch: lp://staging/~andrenasturas/synapse-project/rolldice-plugin
Merge into: lp://staging/synapse-project
Diff against target: 192 lines (+166/-0)
3 files modified
src/plugins/Makefile.am (+1/-0)
src/plugins/rolldice-plugin.vala (+164/-0)
src/ui/synapse-main.vala (+1/-0)
To merge this branch: bzr merge lp://staging/~andrenasturas/synapse-project/rolldice-plugin
Reviewer Review Type Date Requested Status
Synapse core team Pending
Review via email: mp+334442@code.staging.launchpad.net

Description of the change

Plugin for Rolldice.

Adds a plugin for the command-line program rolldice, allowing the user to throw dices and see results in synapse as easily as the calculator plugin.
User only have to type a command in rolldice syntax like "6d10+5" and the result will be printed.
Supports multiple dices rolls by returning as many results as rolls requested by the user.

Should be answering any string supported by rolldice :

Pseudo regex : [Ax]?[B]?dC[*D]?[+|-E]?[sF]?
All parts between brackets are optional.

The command can be interpreted as : "Roll B C-sized dices, drop the lowest F, multiply the result by D and add or subtract E, and do it A times independently".
A, B, C, D, E and F are all numbers.

C can also be "%", which is here a shortcut for "100-sized dice".
C cannot be 0 or 1, as these are not supported as number of faces by rolldice, and lead to unexpected results (rolldice use a default 6-sized dice instead).

Usage example :

"d6" : return a random number between 1 and 6.
"3xd4" : return three results, each being a random number between 1 and 4.
"6d10s4" : return a random number between 2 and 20 with a non-normal distribution, as it will roll 6 dices and keep only the two highest scores (dropping the 4 lowest) before summing.
"d5*2" : return a random even number between 2 and 10.
"d6+6" : return a random number between 7 and 12.

To post a comment you must log in.
Revision history for this message
Michael Aquilina (michaelaquilina) wrote :

Andre, this project isnt really active right now (from what I can tell). For this reason I have a fork on github that has a few improvements https://github.com/MichaelAquilina/synapse-project. Could I suggest you also open a PR there so that we get something released?

Unmerged revisions

656. By André Nasturas <email address hidden>

Added support for multiple rolls with multiple results

655. By André Nasturas <email address hidden>

Merge from main

654. By André Nasturas <email address hidden>

Add Rolldice plugin

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.