Skip to content

[Feature request]: Individual dice results with face in output #292

@nfowler

Description

@nfowler

Feature request and related problem

I'd like the ability to display two pieces of important information for each instance of a roll made: the final result (easy), and the individual rolls made to get that result (not easy).

Because the individual roll results in the JSON output aren't labeled with their face (related #242 ), getting the individual results is quite difficult. To see what I mean, consider the notation: 1d100 + 2d20 + 3d10 + 4d6 + 10. This roll in one instance has the following output: 1d100 + 2d20 + 3d10 + 4d6 + 10: [55]+[13, 4]+[10, 5, 5]+[1, 4, 2, 6]+10 = 115. I can, through navigating the RollResult object, get those individual rolls, but they're devoid of context, which may be confusing with complicated rolls like the example. If I show [55, 13, 4, 10, 5, 5, 1, 4, 2, 6], then I might technically be able to figure out which face belongs to each roll by carefully comparing with the notation, but it's not trivial and easy to make a mistake.

What I would like to do is show show something like: d100: [55], d20: [13, 4], d10: [10, 5, 5], d6: [1, 4, 2, 6].

Suggested solution

Implementing #242 would make this functionality much more practical.

A value in the ResultObject that more closely fulfills this, i.e. just directly giving the individual dice rolls with corresponding face like the example string, would also work and I certainly wouldn't complain, although may be a less general and more complex (for the library) solution.

Alternatives

I'm fairly sure that this is possible in some way with regex, but my attempts to do so failed, and I also can't be sure that if I did come up with a solution, it would be general enough to accommodate the full complexities of possible rolls.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions