Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nfowler opened this issue Dec 22, 2023 · 0 comments
Open

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

nfowler opened this issue Dec 22, 2023 · 0 comments

Comments

@nfowler
Copy link

nfowler commented Dec 22, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant