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

Improve the syntax for evaluation #8

Open
dustinlacewell opened this issue Mar 15, 2018 · 6 comments
Open

Improve the syntax for evaluation #8

dustinlacewell opened this issue Mar 15, 2018 · 6 comments

Comments

@dustinlacewell
Copy link

This would be a pretty backwards incompatible change but I think that we should not interpolate "naked" dice and table references and should introduce some kind of syntax. This would allow those string to appear inside of table entries. I'm thinking something similar to roll20 syntax would suffice:

  • Dice: [[ 1d20+5 ]]
  • Tables*: t[table-name]

What this does, I think, is make it clearer in a table entry, what is actually going to be interpolated and what is just plain text. Sometimes I want to say "1d6" in a table entry without actually replacing it with a roll.

@lifelike
Copy link
Owner

I like this, but for clearer text I would prefer to have the same markup for dice and tables (and ranges, and choices) eg just []. If someone names their table 3d6 or 4--7 etc I think that is an acceptable risk to not have to remember extra prefix, and I think there is a (partial?) dwim function already?

@lifelike
Copy link
Owner

The function is called decide-dwim-insert. There is also an old dwim branch where I attempted to improve on that. One part was to make a function that could find all die-rolls in region and replace them with rolled numbers. I thought of using that in combination with things like yasnippets to automatically insert a template and then roll random numbers. But with some markup like that suggested in this issue that function could be even more powerful, as long as some markup is chosen that does not conflict too much with for instance how yasnippet snippets are defined. I think [2d6] and [tablename] would work for instance. I would not want double brackets because that would look like links to org-mode. Maybe it is possible to come up with a syntax and a helper function that can solve decide-table, decide-dwim-insert and decide-replace-in-region?

@AkashaRepo
Copy link

AkashaRepo commented Nov 6, 2023

It would be nice if die syntax could include multiple modifiers and comments that serve to label them.

Right now if I try to roll
1d10+5+2
I get
[1d10+5] -> (7) +5 = 12
instead of
[1d10+5+2] -> (7) +5 +2 = 14

Obviously I could have rolled 1d10+7 and gotten the desired result, but some users will prefer parsing each modifier separately and letting the computer handle the addition.

It would also be nice if comments could be added to the die roll, so each modifier could be labeled. For instance, something like
1d10+5stat+2skill
would output
[1d10+5+2] -> (7) +5stat +2skill = 14

@lifelike
Copy link
Owner

lifelike commented Nov 7, 2023

The last comment probably should be its own issue?

I have thought about adding some more dice-syntax like in other die-rollers, for things like "keep the N lowest", and I also want to add some feature to roll buckets of dice ("roll 45d6 and count how many 5+"). But adding things like that in ways that I have seen other tools do might conflict with allowing labels in the spec.

And if allowing 1d10+5+2 it would be nice to also allow 1d10+1d6+2 and things like that. Would require a major rewrite of how to parse and roll dice, and how to present the results.

@AkashaRepo
Copy link

The last comment probably should be its own issue?

Possibly, but I was afraid of spamming. Should I create a new issue or is this a low priority?

@lifelike
Copy link
Owner

lifelike commented Nov 7, 2023

I think it can be good to have a few small feature requests like that open for discussion and in case someone wants to implement them. Not very high priority for me.

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

No branches or pull requests

3 participants