AnyDice provides two operations that allow you to query a value about its contents.
#
operation to get the length of a value. What that means depends on the type of value involved.
#{2,4,6}
yields 3
.#(3d6)
yields 3
. Note the
parentheses, without them it would be intepreted as (#3)d6
, which would yield 1d6
.1
.@
operation, you can retrieve individual numbers stored inside a value. You can either provide the position of a single
value to retrieve, or a sequence of positions, in which case the retrieved values are summed. If you ask for a position that does not exist,
the result for that position will be 0
.
1@{2,4,6}
yields 2
,
3@{2, 4, 6}
yields 6
, {1,3}@{2,4,6}
yields 8
, and {1,2,2}@{2,4,6}
yields 10
.1@3d6
will select the highest
rolled value, while 3@3d6
will select the lowest rolled value. {1,2}@3d6
will sum the highest two of the rolled values,
discarding the lowest rolled value. The result of the operation is a new die containing the selected
values of all possible rolls and their appropriate odds.1@246
yields 2
, while {1..3}@246
yields 12
.set "position order" to "lowest first"
output 1@3d6 named "lowest die"
output 1@246 named "least significant digit"
set "position order" to "highest first" \ the default behavior \
output 1@3d6 named "highest die"
output 1@246 named "most significant digit"