Rolisteam/DiceParser

Strange `-` behavior in macro

tim-elmer opened this issue · 3 comments

Trying to add a macro to the Discord bot, encountering unexpected response.

I'm attempting to add the macro Pattern: -d([0-9]+) Command: 2d\1kl1 Regexp: True, with the intent of making DnD 5e advantage/disadvantage rolls a bit easier to remember. This works fine with Pattern: \+d([0-9]+) Command: 2d\1k1 Regexp: True (+dX e.g. +d20), but using -dX (e.g. -d20) results in the bot returning an image:
image

Perhaps this is a collision with the arithmetic operators? I changed the - in the pattern to \. and that works just fine.

There definitely seems to be something in DiceParser with -d (not sure if it is the minus, the d, the combination, or what). I tried creating a macro sym-d([0-9]+) and that failed but changing it to symd or sym-x worked fine (just not sym-d).

I strongly recommend to set -1dX instead of -dX.

And if you roll only this command !-d10

The - symbol is read as math operation Nothing - d10 make no sense.
And
-d10 make no sense too. You may want to roll 1d[-10..-1]
or 0-d10

That's fine, as I've found a workaround, but any characters (or sequences of characters) that cannot be used in a macro should be documented.