To satisfy a number of request for more detailed dice control (over things like rerolls), and a way to clean up dice references, and, as I realized this morning, a way to help to implemented "cards", I've come up with an interesting solution that I'm calling "augmented values".
If you roll a single die (or a list of dice such as "3d6@"), besides being a simple numeric value, there will also be "augmented properties" on that value, which can be accessed via the subscript  operator. So, if you roll:
you'll get some sort of open ended value. If, for some reason, you wanted to see what each of the values that went into that total value (i.e., examine all the rerolls), you can do:
and you'll either get a single value (if there was nothing re-rolled) or a list of values (just so happens that it'll be one or more 6s and then the final value).
For the potential "playing card" support, you can do:
and get something like "Six of Spades"
and get 6
and get 4 (where Clubs = 1, Diamonds = 2, Hearts = 3, Spades = 4)
This will also make the :badge: action easier to use (which uses the "index" of the die, which is now one of the augmented properties). For example, to add a green tint to the higher of two dice easily:
Code: Select all
@higher <- d+6 \/ d+4.
:badge:( ":red:", @higher["index"])
(augmented properties are maintained on certain operators, notably "/\", "\/", "<-", ",", "." and ideally even when using an if statement - anything that doesn't result in throwing away an old value and creating a new one (such as addition, subtraction, etc...)