Closed andrenasturas closed 6 years ago
Thanks for this @andrenasturas ! The build passes so its pretty certain this works, but will test this out manually just in case.
Eventually my intention is to add some automated tests along with just building on the CI.
Is rolldice
part of any package manager? I cant seem t find it on ubuntu trusty or opensuse tumbleweed. Could you provide a link I can use to test with?
rolldice
is in Ubuntu Universe : https://packages.ubuntu.com/fr/trusty/rolldice
I don't know if it is available in OpenSUSE.
Seems pretty easy to compile: https://github.com/sstrickl/rolldice Will probably try add this myself to opensuse's build service and go from there
As rolldice is a command-line program, it is not provided with any icon, so I chose an icon present on my system (Voyager Live 16.04, which is based on Xubuntu 16.04, with Faenza icon set) that made sense for this application : application-boardgames
I will replace that with applications-games
which, according to the specifications you provided, is a standard icon name.
About the "Send to" action, it seems to be the first default action when none are provided by the plugin : when you press Tab while selecting one of the plugin results, you have some actions available like "Copy to clipboard", "Send to pastebin" or "Search on internet", "Send message to" being the first one. It is the same with the calculator plugin which I was inspired by.
It is possible to convert the TextMatch
object to an ActionMatch
object so the ResultSet comes with a specific action, or to provide many specific actions by implementing ActionProvider
interface (like in the Desktop File plugin) but I don't know if it can be more relevant than the default actions. All I am thinking about is an action to start a rolldice interactive console, and since it is not possible to start one already showing a result, it may not be very interesting.
Fine, thanks :-)
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 the character
%
, 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.