Dice roller documentation

xavi
Administrator
xavi
edited June 2017 in General Discussion
Arithmetic
1+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 rolling
2d6 - 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 dice
5d6e - 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 dice
5d6r - 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 results
5d6{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/failures
Note 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/lowest
5d6{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/lowest
5d6{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 :D - try rolling SR5(7) for example)

Comments

  • xavi
    xavi
    Administrator Administrator
    Please post if you have any doubts or comments and I'll edit it to clarify it
  • Kepli
    Kepli
    Member Member
    Nice array of possibilities.
    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?

  • CmdrRamon2
    CmdrRamon2
    Member Member
    Thank a lot for this documentation.

    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
  • xavi
    xavi
    Administrator Administrator
    @Kepli did you try enabling the character dice bag and saving any relevant rolls of that character there? Are you thinking of something else?

    @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!
  • Kepli
    Kepli
    Member Member
    Just asking questions without testing yet :)
    Will get into it.
  • Smitemeister
    Smitemeister
    Administrator Administrator
    Thanks, CmdrRamon2. The future version of the Skirmish! client will greatly improve accessibility and a LOT of other things.
  • peppopeppis
    peppopeppis
    Member Member
    Is this documentation still current with the new open beta?
    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)?
  • Smitemeister
    Smitemeister
    Administrator Administrator
    Hi, this is the documentation that works with the beta. SR5 rolls should work and can even include edge rerolls but I'll let Javi explain it since the dice roller is his domain.  :)

    And yes, the dice roller is planned to allow custom dice rolling functions; with additional simplified controls and examples for non-programmers.
  • xavi
    xavi
    Administrator Administrator
    make sure to write SR5, in uppercase. it matters 
  • EdgeNightwind
    EdgeNightwind
    Member Member
    Hi ! 
    Is it possible to put a dice roll like that ( 1d20+str_valuefromcharacterstatplugin) ?
  • Smitemeister
    Smitemeister
    Administrator Administrator
    Input like this will work with the updated char stats plug-in, however in a more accessible way.
  • EdgeNightwind
    EdgeNightwind
    Member Member
    So its not possible right now ?
  • Julian
    Julian
    Member Member
    What about setting up Character Traits and tying dice rolls to them. Can i add a Meter to a Dice Roll and are Meters really the only way to add Traits and ratings to a character. 

    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.  
  • Draygon01
    Draygon01
    Member edited January 2019 Member
    @xavi
    I am wondering the same as Julian.  

    How could I roll a d20 + modifier?

    is it like:
    < roll 1d20 + (id_save(id_dex)) >
  • Gianna
    Gianna
    Member Member
    Your sharing stuff is nice and great. You have share the basics things with us.  by the way, i agree with Kepli and i have a same question. 
  • udit
    udit
    Member edited January 2024 Member
    gb whatsapp pro download The dice roller documentation is a game-changer! Clear instructions, examples, and API details make it easy to implement in various projects. Now, creating random outcomes is a breeze. Kudos to the developers for simplifying the process and enhancing gaming experiences. Roll on, dice enthusiasts!


  • sakina2
    sakina2
    Member Member
    Please let me know are you interested in advanced dice rolling mechanics for tabletop games, like exploding dice, rerolls, or counting successes? This guide covers everything from arithmetic operations on dice rolls to success counts and built-in functions, perfect for any custom game system. What dice mechanic are you most curious about? gb whatsapp pro apk

  • gbapks2
    gbapks2
    Member Member
    GB WhatsApp APK Download (Anti-Ban) Latest Version March 2025 OFFICIAL, Get GB WhatsApp Latest Version Updated To The Latest WhatsApp Base, With Amazing Features, Hide Last seen, More Themes, Anti-Delete Messages.
Sign In or Register to comment.

Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

© Copyright 2014 - Creative Dreams | Powered by Vanilla
All times are UTC