Open phylll opened 2 years ago
roll()
sends a /roll
chat command to Roll20 and waits for the result. :)
Strictly speaking, with how open-ended roll expressions could theoretically be, I'm not even sure if calculating the maximum potential roll can be done without either brute-forcing all potential rolls or doing some fancy computer algebra.
Consider:
/roll 10-(1d20-10)**2
/roll 1d20%5
That said… if we change the problem description to "roll result if all dice roll critical success" (or failure), it becomes a bit easier – maybe I can make MMM sufficiently aware of Roll20's zoo of roll suffixes to substitute each NdX
expression with its respective "critical success" roll result and have Roll20 re-evaluate the expression with that.
Um, ok. I need this for pretty simple roll expressions limited to NdX+/-Y
. And since the X is always the maximum roll for that type of die, my immediate use case would be served already by transforming the expression into N * X +/- Y
and calculating that.
I need to get the maximum result for a given roll expr, e.g.
8
for1d6+2
. By extension, I can imagine similar use cases where I'd need the minimum result.Presumably,
roll()
already knows how to interpret roll expressions, so this might be a quick tweak for another version of calling theroll()
function?