- Notifications
You must be signed in to change notification settings - Fork31
Powerful dice Roller is used as discord bot, irc bot, cli tool and inside Rolisteam : 1d20+4, 1L[head,arm,leg,belly,chest], 1d6+1d8, 8+5*3
License
GPL-3.0, GPL-2.0 licenses found
Licenses found
Rolisteam/DiceParser
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Rolisteam Dice Parser run dice commands. It is available on several platforms.The syntax is simple and powerful.
99.9%
uptime- Roll any kind of dice
- Customizable prefix
- Custom alias/macro to improve game experience
- Manage colorized dice
- Many operators
Roll 3 dice with 100 faces
Roll 10 dice with 10 faces, 10 explodes, and sort the result.
roll 100291 dice with 66666666666 faces and sort result
roll 15 dice with 10 faces and it counts number of dice which are above 7
roll 1 die with 8 faces and add the result to 2 dice with 6 faces and add 7.
roll 1 die with 25 faces
88 minus the value of 1 die of 20 faces
compute: 24
compute: 100/28 = 33*3 = 9
More examples at :https://invent.kde.org/rolisteam/rolisteam-diceparser/-/blob/master/HelpMe.md
The grammar is something like this:
Program =: Instruction [InstructionSeparator, Instruction]* CommentInstructionSeparator = ;Instruction =: Expression ([Operator, Expression]* | [Option]*)Operator =: ScalarOperatorExpression =: OpenParenthesis Expression closeParenthesis| Option*| [Operator, Expression]*| Operand Dice| Command| function| NodeOperator [Option]*| ValuesList| Dice (Operand == 1)Operand =: DynamicVariable | Number | StringOpenParenthesis = (closeParenthesis = )OpenList = [CloseList = ]ListSeparator = ,ValuesList=: OpenList (DynamicVariable | Number)? [ ListSeparator,(DynamicVariable | Number)]* CloseListDice =: DiceOperator [uniqueValue] DiceParameterDiceOperator =: D ParameterDice | L ParameterListDiceParameter =: ParameterDice | ParameterListParameterDice =: Number|RangeParameterList =: ListList=: OpenList String[Probability] [ListSeparator,String[Probability]]* CloseListProbability=: OpenList (Range|Percentage) CloseListPercentage =: numberfunction =: functionName OpenParenthesis [function_args] closeParenthesisfunction_args =: Instruction [InstructionSeparator, Instruction] | Operand | ValidatorListfunctionName =: repeatOption =: Keep| KeepAndExplode| Filter| Sort| Count| Reroll| RerollUntil| RerollAndAdd| Explode| Merge| Bind| Occurences| Unique| Paint| If| Split| GroupRange =: OpenList Number RangeSeparator Number CloseListRangeSeparator =: ..ScalarOperator =: [x,-,*,x,/,**]number =: [-] [0-9]+ | constantValueOpenVaribale=: ${CloseVariable=: }constantValue =: OpenVaribale (id | label) CloseVariableid=[_,a-z][_,A-z,0-9]* # must respect rules of QML idlabel=.*variable = OpenVaribale [0-9]+ CloseVariableValidatorList =: OpenList CompareMethod Validator [LogicOpetator CompareMethod Validator]* CloseListLogicOpetator =: AND | XOR | ORCompareMethod =: Each | All | Scalar | ANYEach=:All=: *Scalar=: :ANY=: .AND =: &XOR =: ^OR =: |Ascendant=:lValidator =: BooleanValidator | RangeValidator | OperationValidatorCompareOpetator =: = | > | >= | < | <= | !=RangeValidator =: RangeOperationValidator =: Modulo operandNode BooleanValidatorModulo =: %BooleanValidator =: [=]Operand | [CompareOpetator Operand]ListOfValue=: String[Range],ListOfValue | String[Range]String =: .*[^ListSeparator]Keep =: k[Ascendant] NumberKeepAndExplode =: K[Ascendant] numberFilter =: f ValidatorListSort =: s[Ascendant]Count =: c ValidatorListReroll =: r ValidatorListRerollUntil =: R ValidatorListRerollAndAdd =: a ValidatorListMerge =: mBind =: bOccurences =: OccurencesWidth ( ListSeparator number | ValidatorList)OccurencesWidth =: numberunique =: uPainter =: p PainterParametersPainterParameters =: OpenList PairColorOccurence [ListSeparator , PairColorOccurence]* CloseListPairColorOccurence =: Color PairSeparator NumberPairSeparator =: :If =: i [compareMethod] ValidatorList Bloc[Bloc]compareMethod =: OnEach | OneOfThem | AllOfThem | onScalarOnEach =: ''OneOfThem = '.'AllOfThem = '*'onScalar = ':'Bloc =: OpenBranch Expression CloseBranchOpenBloc =: {CloseBloc =: }Split =: yGroup =: g NumberSort =: sGroup =: numberExplode =: e ValidatorListNodeOperator = JumpbackwardJumpbackward =: @Merge =: m | m ExpressionCommand =: help | launiqueValue = uComment =: StartComment StringStartComment =: #
git clone --recursive https://invent.kde.org/rolisteam/rolisteam-diceparser.gitcd rolisteam-diceparsermkdir buildcd buildcmake ../ -DBUILD_CLI=ONmakesudo make install
About
Powerful dice Roller is used as discord bot, irc bot, cli tool and inside Rolisteam : 1d20+4, 1L[head,arm,leg,belly,chest], 1d6+1d8, 8+5*3