Arithmetic1+2 - add (3)
1-2 - subtract (-1)
1*2 - multiply (2)
7+/3 - divide and round up (2.333 -> 3)
7~/3 - divide and round up or down, whichever is closer (2.333 -> 2)
7/4 (or 7-/4) - divide and round down (1.75 -> 1)
7%4 - divide and get the remainder (3)
2+**-2 - 2 powered to -2, rounded up (0.25 -> 1)
2~**-2 - 2 powered to -2, rounded to whichever is closer (0.25 -> 0)
2**3 (or 2-**3) - 2 powered to 3, rounded down (8)
Basic dice rolling2d6 - roll 2 dice of 6 faces (1 to 6)
2d[2..4] - roll 2 dice with faces valued 2, 3, 4
2d[-1, 0, 1] - roll 2 dice with faces valued -1, 0 and 1
2dF() - roll 2 fudge dice (same as 2d[-1, 0, 1]
2dUB() - roll 2 ubiquity dice (same as 2d[0, 1]
Exploding dice5d6e - roll it exploding 6s (exploding means if you get a 6 reroll it and add it to the pool of results)
5d6eo - same as above, but each die can only be exploded once
5d6e(>=5) - roll it exploding 5s and 6s
5d6ep - penetrating exploding; roll it, but each exploding die has -1 each time it is exploded (can be used with 'o' at the end for once)
5d6ec - compounding exploding; roll it, but each exploding die is summed to count as a single big die (e.g, if you do 2d6ec and one of the die gets a 6, a 6 and a 5 that die will count as a 17) (can be used with 'o' at the end for once)
Rerolling dice5d6r - roll it rerolling 1s (rerolling replaces the old result with the new one)
5d6ro - same as above, but rerolling 1s can only be done once
5d6r(<=2) - roll it rerolling 1s and 2s
Operate over results5d6{sum} - roll it and sum all results
5d6{+5} - roll it and add +5 to each result (any arithmetic operation is valid)
5d6{len} - the number of dice (5), not overly useful on its own, but can be chained
Count successes/failuresNote that successes count as 1, failures as -1 and neither as 0
5d6{>=4} - roll it and count results >= 4 as successes
5d6{>=4 - <=2} - roll it and count results >= 4 as successes and <= 2 as failures
5d6{>=4 or <=2} - roll it and count results that are >= 4 or <= 2 as successes
5d6{>=3 and <=5} - roll it and count results that are both >= 4 and <= 5 (between 4 and 5) as successes
5d6{>=4, <=2} - roll it and count
separately results >= 4 and results <= 2
Drop highest/lowest5d6{dl3} - roll it and drop the 3 lowest dice
5d6{dh3} - roll it and drop the 3 highest dice
5d6{d<=3} - roll it and drop any results <= 3
Keep highest/lowest5d6{kl3} - roll it and keep the 3 lowest dice
5d6{kh3} - roll it and keep the 3 highest dice
5d6{k>=3} - roll it and keep any results >= 3
Chains
5d6{kh4}{/5} - roll it, keep highest 4 dice and then divide each one by 2
5d6{k>=4}{len} - roll it, keep dice >= 4 and then count how many dice are there (mostly the same as 5d6{>= 4} really)
Comparisons (cannot be used stand-alone)>= 4 - greater or equal than 4
> 4 - greater than 4
== 4 - equals 4
!= 4 - not equals 4
< 4 - less than 4
<= 4 - less than or equals 4
>= 4 and <=6 - greater or equals to 4 and less or equals to 6
>=4 or <= 2 - greater or equals to 4 and less or equals to 2
Arrays
Expressions such as 5d6 are ultimately expanded into arrays (e.g. [3, 3, 6, 1, 2])
[3..6] - 3 to 6, expands to [3, 4, 5, 6]
[4x3] - a 4 repeated 3 times, expands to [4, 4, 4]
[3, 3, 6, 1, 2]{kh2} - keep highest 2 values, so [3, 6]
Built-in value functions
COERCE_VALUE(1d6, 2, 4) - coerce the value between 1 and 6 to be >= 2 and <=4
MIN_VALUE(1d6, 1d6) - returns the min value between the 2 given
MAX_VALUE(1d6, 1d6) - returns the max value between the 2 given
ABS_VALUE(-5) - returns the absolute (positive) value (5 in this case)
Built-in array functions
COERCE_ARRAY(5d6, 2, 4) - roll it and make each value be between 2 and 4
SORTASC_ARRAY(5d6) - roll it and sort results from lowest to highest
SORTDESC_ARRAY(5d6) - roll it and sort results from highest to lowest
ABS_ARRAY(5d6) - roll it and make each value absolute
And more...There's more, I'll write about it another day, but basically for example a ShadowRun 5 roll is used as:
SR5(DICE, HITLIMIT = false, GREMLIN = 0) -> [hits, glitch]++roll
and defined as:
ROLL = if (EDGE) { DICE d6e } else { DICE d6 } <'Roll: ' R>;
HITS = ROLL{>=5};
ONES = ROLL{<=1};
GLITCH = if (ONES > (DICE/2) - GREMLIN) { true } else { false };
LIMITEDHITS = if (HITLIMIT <= 0) { HITS } else { MIN_VALUE(HITS, HITLIMIT) } <R{sum} ' hits'>;
CRITICALGLITCH = if (GLITCH and LIMITEDHITS<=0) { true } else { false };
[LIMITEDHITS, GLITCH] + ROLL
<
if (CRITICALGLITCH) { 'Critical glitch! ' }
else {
LIMITEDHITS ', '
if (GLITCH) { 'Glitch! ' }
}
ROLL
>
(and yep, that works
- try rolling SR5(7) for example)
Comments
Are you going to create some graphical way of creating/selecting these, or can you assign programmed rolls to keys/buttons? And can you save specific calculations you like to sue more often?
It would be great to have this documentation when we write "\help" in the tchat window, don't you think.
Honestly it's the best VTT I have found on the web.
I'm ready for your next Kickstart.
Thank you
@CmdrRamon2 nice idea about the /help thing, in the next version we will just add a help button that once clicked will open the help in a window. And thanks!
Will get into it.
Basic expressions like exploding seem to work correctly, but I couldn't figure out how to roll Sr5 with the new global dice bag.
Also, will it be possible for users to write their own dice rolling fucntions (like the SR5 example above)?
And yes, the dice roller is planned to allow custom dice rolling functions; with additional simplified controls and examples for non-programmers.
Is it possible to put a dice roll like that ( 1d20+str_valuefromcharacterstatplugin) ?
What i need for all of my games is an easy way to add 2 traits together so a dice roll can be based on them. For most games this is ([Attribute or Advantage] + [Skill or Ability] = number of dice rolled), since these traits are combined from a list of 10 or more Attributes and Advantages and 30 or more skills and Abilities, based on the situation and action taken, you can imagine that it would be the devils work to set up a seperate dice roll for each possible combination, for every individual character.
so how exactly do you suggest i approach this.
I am wondering the same as Julian.
How could I roll a d20 + modifier?
is it like:
< roll 1d20 + (id_save(id_dex)) >