Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

how to create a script similar to Star Wars FFG dice roller

can anyone give me a easy tutorial on creating API script for a dice roller similar to the ones in Star Wars FFG  dice will be d6 .. but the results will be .. 'blank, 1 sword, 1 sword, 1 sword, 2 sword, 3 sword'  instead of 1,2,3,4,5,6 (or similar) (i will if i understand the programming.. add graphics to the mix) what html, css, and api script is needed to make a functional roller? any help! thanks in advance
1667573778
The Aaron
Roll20 Production Team
API Scripter
So, one thing about the Star Wars FFG dice roller is the calculation of all the pools each of the faces represent.  If your game is simply counting swords in a non-linear way, that can be handled very easily with a Rollable Table.  You can provide the names and ranks as follows, assuming a table named "swords": "0 [blank]" at rank 1 "1 [sword]" at rank 3 "2 [sword]" at rank 1 "3 [sword]" at rank 1 And then roll that as: [[ 1t[swords]]] to get a die that has the right distribution of values. Can you discuss your game mechanics as it relates to that die in more detail, that might help with pointing you in the right direction.
BLACK&nbsp; blank, blank, 1 claw, 1 claw, 1 scratch, 1 claw + 1 scratch --- one for each baddie minion you are fighting PURPLE 1 sword, 2 sword, 3 sword, 1 mana, 2 mana, shadow --- one only BLUE blank, blank, shield, 1 shield, 1 shield, 2 shield GREEN blank, 1 shield, 1 shield, 1 shield, 2 shield, 3 shield YELLOW blank, 1 sword, 1 sword, 2 sword, 1 sword + 1 mana, 1 sword + 1 mana ORANGE blank, 1 sword, 2 sword, 2 sword, 3 sword, 1 sword + 1 mana RED 1 sword, 1 sword, 3 sword, 4 sword, 1 sword + 1 mana, 2 sword + 1 mana the dice are used in the game&nbsp; &nbsp;Massive Darkness&nbsp; (1E and 2E) was looking at the html and scc of&nbsp; 'Edge of the Empire' .. i'm fairly good at re-writing character sheets ...&nbsp; most of the sheet would not be needed.. MD character lay outs are simple.. no need for stats and skills..&nbsp;&nbsp; as the char gains new equipment.. that changes the dice pool&nbsp; <a href="https://cf.geekdo-images.com/nDY-CkS_ixyNGSv_WqjQfw__imagepage/img/02tE3XLonkIHQbTUPAFspVx7bCs=/fit-in/900x600/filters:no_upscale():strip_icc()/pic5960520.jpg" rel="nofollow">https://cf.geekdo-images.com/nDY-CkS_ixyNGSv_WqjQfw__imagepage/img/02tE3XLonkIHQbTUPAFspVx7bCs=/fit-in/900x600/filters:no_upscale():strip_icc()/pic5960520.jpg</a> <a href="https://i.ebayimg.com/images/g/d0wAAOSwFPJisdvt/s-l400.jpg" rel="nofollow">https://i.ebayimg.com/images/g/d0wAAOSwFPJisdvt/s-l400.jpg</a>
1667587553
The Aaron
Roll20 Production Team
API Scripter
Ok, that makes sense.&nbsp; You're right, you're definitely in the realm of script writing here. If I were setting about to do this, I'd start by building a structured representation of each of the pools, then define the types of dice under those, something like: const DicePools = { 'shadow': { name: 'Shadow Die', faces: [ { face: 'https://....', values: { shadow: 1, sword: 0, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: 'https://....', values: { shadow: 0, sword: 1, mana: 0, shield: 0, unblockable: 0, monster: 0 } } /* ... */ ] }, 'monster': { /* ... */ }, 'yellow': { /* ... */ }, 'orange': { /* ... */ }, 'blue': { /* ... */ } }; Once you have that, You'd write a function that can use that data to generate the random roll given some dice expression.&nbsp; Then you write an API command to recognize that dice expression and get the roll result with the function, then you write something that displays a result to chat. If you want to assemble that structured data above, I can assist with the skeleton of using it to generate roles, or write some more detailed descriptions around what you'd need to do.
const DicePools = { &nbsp; 'shadow': { &nbsp; &nbsp; name: 'Shadow Die', &nbsp; &nbsp; faces: [ &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 2, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 3, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 2, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; ] &nbsp; }, &nbsp; 'enemy': { &nbsp; &nbsp; name: 'Enemy Die', &nbsp; &nbsp; faces: [ &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 1 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 1 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 1 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; ] &nbsp; }, &nbsp; 'yellow': { &nbsp; &nbsp; name: 'Yellow Die', &nbsp; &nbsp; faces: [ &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 2, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; ] &nbsp; }, &nbsp; 'orange': { &nbsp; &nbsp; name: 'Orange&nbsp; Die', &nbsp; &nbsp; faces: [ &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 2, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 2, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 3, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; ] &nbsp; }, &nbsp; 'red': { &nbsp; &nbsp; name: 'Red&nbsp; Die', &nbsp; &nbsp; faces: [ &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 3, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 4, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 2, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; ] &nbsp; }, &nbsp; 'green': { &nbsp; &nbsp; name: 'Green Die', &nbsp; &nbsp; faces: [ &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 2, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 3, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; ] &nbsp; }, &nbsp; 'blue': { &nbsp; &nbsp; name: 'Blue Die', &nbsp; &nbsp; faces: [ &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 2, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, &nbsp; &nbsp; ] &nbsp; } };
i think i will have to make my own pic art of the dice faces...&nbsp; not much on line showing all the different sides. next work thro the actual CS, work out a tidy lay out and how to set up the various abilities for the different classes
also .. i know i cannot create a 'compedium' for drag and drop items&nbsp; like in D&amp;D.. but can drag and drop work on 'decks' of created rollable tables (i.e. treasure cards.. dropped into the equipment on a character sheet..?
Sorry if i'm being a pest!&nbsp; i found a SW API script.. but there is a huge amount of code.. ( much of which i don't need or understand).. any chance you can doctor it for my needs??? <a href="https://github.com/Roll20/roll20-api-scripts/blob/master/FFG-SWRPG-Dice-Roller/2.6/EotE-Dice.js" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/blob/master/FFG-SWRPG-Dice-Roller/2.6/EotE-Dice.js</a> i just need something that shows the number of different dice, each different colour, what was rolled, doubt i need them totaled any help would be appreciated thanks
&nbsp; &nbsp;&lt;input type="hidden" name="attr_dicePool"&nbsp; value=" @{yellow}yellow @{orange}orange @{red}red @{purple}shadow @{blue}blue @{green}green @{black}enemy "/&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;br&gt;&lt;button type='roll' style="font-size: 20px; border: solid gold 2px; color: black" name='roll_DicePool' value='!eed characterID(@{character_id}) label(Dice:Dice Pool) @{dicePool}'&gt;Roll&lt;/button&gt; &nbsp; &nbsp; &nbsp; &nbsp; (copied from Star Wars sheet! so i guess not written for this. will need altering.) &lt;script type='text/worker'&gt; const DicePools = { &nbsp; 'shadow': { &nbsp; &nbsp; name: 'Shadow Die', &nbsp; &nbsp; faces: [ &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; face: 'https://....', &nbsp; &nbsp; &nbsp; &nbsp; values: { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadow: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sword: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mana: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shield: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unblockable: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monster: 0 &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; }, (etc.) what do i need in the API script to add the rolls together..&nbsp; totals for swords, shields etc.. also using a &lt;select&gt; and &lt;script&gt; can i change the Bio picture / token.. on the sheets?
1669912022
The Aaron
Roll20 Production Team
API Scripter
Oops, this fell off my radar and I got a little busy with other things.&nbsp; I'll set a reminder to try and help this weekend.
thanks again.. got the basics down..&nbsp; need to scan and build a lot of decks and token piles...&nbsp;&nbsp; the dice roller is the part i really have no idea how to ceate..&nbsp; (not played with API) i hope the script worker part is right... for the dice images.. (created them) please don't write a huge API program...&nbsp; just something that rolls all relevent dice and states totals of each type and no major rush...&nbsp; don't have to bust a gut, if you are busy.. thanks for all the time and effort
1670210943
The Aaron
Roll20 Production Team
API Scripter
Ok. Here's a script that handles this.&nbsp; The basic format is: !mdd &lt;#&gt;&lt;type&gt; [...&lt;#&gt;&lt;type&gt;] where # is the number of dice to roll and type is which ones.&nbsp; Type is one of: b for blue dice e or bk for enemy dice g for green dice o for orange dice r for red dice s or p for shadow dice y for yellow dice So, to roll 3 blue dice, 2 purple dice and a red die: !mmd 3b 2p 1r Order doesn't matter and you can specify the same die multiple times: !mmd 1b 3r 2b 2g 1y 2s 3e 2r 1bk I don't know if it matters, but you can use !wmmd to whisper the result. Here's what output looks like calling `!mdd 6y 7o 3r 4b 3g 4p 8e`: It will only show tallies for things that were rolled: Note: currently, the images are on my own web server, but I'll move them into Roll20 if that all seems good to you?&nbsp;&nbsp; Try it out and let me know what you think! Mod Script Code: on('ready',()=&gt;{ const DicePools = { 'shadow': { name: 'Shadow Die', faces: [ { face: '<a href="http://roll20api.net/mdd/Purple6.png" rel="nofollow">http://roll20api.net/mdd/Purple6.png</a>', values: { shadow: 1, sword: 0, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Purple3.png" rel="nofollow">http://roll20api.net/mdd/Purple3.png</a>', values: { shadow: 0, sword: 1, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Purple4.png" rel="nofollow">http://roll20api.net/mdd/Purple4.png</a>', values: { shadow: 0, sword: 2, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Purple5.png" rel="nofollow">http://roll20api.net/mdd/Purple5.png</a>', values: { shadow: 0, sword: 3, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Purple1.png" rel="nofollow">http://roll20api.net/mdd/Purple1.png</a>', values: { shadow: 0, sword: 0, mana: 1, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Purple2.png" rel="nofollow">http://roll20api.net/mdd/Purple2.png</a>', values: { shadow: 0, sword: 0, mana: 2, shield: 0, unblockable: 0, monster: 0 } }, ] }, 'enemy': { name: 'Enemy Die', faces: [ { face: '<a href="http://roll20api.net/mdd/Black1.png" rel="nofollow">http://roll20api.net/mdd/Black1.png</a>', values: { shadow: 0, sword: 0, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Black2.png" rel="nofollow">http://roll20api.net/mdd/Black2.png</a>', values: { shadow: 0, sword: 0, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Black4.png" rel="nofollow">http://roll20api.net/mdd/Black4.png</a>', values: { shadow: 0, sword: 0, mana: 0, shield: 0, unblockable: 0, monster: 1 } }, { face: '<a href="http://roll20api.net/mdd/Black5.png" rel="nofollow">http://roll20api.net/mdd/Black5.png</a>', values: { shadow: 0, sword: 0, mana: 0, shield: 0, unblockable: 0, monster: 1 } }, { face: '<a href="http://roll20api.net/mdd/Black3.png" rel="nofollow">http://roll20api.net/mdd/Black3.png</a>', values: { shadow: 0, sword: 0, mana: 0, shield: 0, unblockable: 1, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Black6.png" rel="nofollow">http://roll20api.net/mdd/Black6.png</a>', values: { shadow: 0, sword: 0, mana: 0, shield: 0, unblockable: 1, monster: 1 } }, ] }, 'yellow': { name: 'Yellow Die', faces: [ { face: '<a href="http://roll20api.net/mdd/Yellow1.png" rel="nofollow">http://roll20api.net/mdd/Yellow1.png</a>', values: { shadow: 0, sword: 0, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Yellow2.png" rel="nofollow">http://roll20api.net/mdd/Yellow2.png</a>', values: { shadow: 0, sword: 1, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Yellow3.png" rel="nofollow">http://roll20api.net/mdd/Yellow3.png</a>', values: { shadow: 0, sword: 1, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Yellow6.png" rel="nofollow">http://roll20api.net/mdd/Yellow6.png</a>', values: { shadow: 0, sword: 2, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Yellow4.png" rel="nofollow">http://roll20api.net/mdd/Yellow4.png</a>', values: { shadow: 0, sword: 1, mana: 1, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Yellow5.png" rel="nofollow">http://roll20api.net/mdd/Yellow5.png</a>', values: { shadow: 0, sword: 1, mana: 1, shield: 0, unblockable: 0, monster: 0 } }, ] }, 'orange': { name: 'Orange Die', faces: [ { face: '<a href="http://roll20api.net/mdd/Orange1.png" rel="nofollow">http://roll20api.net/mdd/Orange1.png</a>', values: { shadow: 0, sword: 0, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Orange2.png" rel="nofollow">http://roll20api.net/mdd/Orange2.png</a>', values: { shadow: 0, sword: 1, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Orange4.png" rel="nofollow">http://roll20api.net/mdd/Orange4.png</a>', values: { shadow: 0, sword: 2, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Orange5.png" rel="nofollow">http://roll20api.net/mdd/Orange5.png</a>', values: { shadow: 0, sword: 2, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Orange6.png" rel="nofollow">http://roll20api.net/mdd/Orange6.png</a>', values: { shadow: 0, sword: 3, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Orange3.png" rel="nofollow">http://roll20api.net/mdd/Orange3.png</a>', values: { shadow: 0, sword: 1, mana: 1, shield: 0, unblockable: 0, monster: 0 } }, ] }, 'red': { name: 'Red Die', faces: [ { face: '<a href="http://roll20api.net/mdd/Red1.png" rel="nofollow">http://roll20api.net/mdd/Red1.png</a>', values: { shadow: 0, sword: 1, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Red2.png" rel="nofollow">http://roll20api.net/mdd/Red2.png</a>', values: { shadow: 0, sword: 1, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Red5.png" rel="nofollow">http://roll20api.net/mdd/Red5.png</a>', values: { shadow: 0, sword: 3, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Red6.png" rel="nofollow">http://roll20api.net/mdd/Red6.png</a>', values: { shadow: 0, sword: 4, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Red3.png" rel="nofollow">http://roll20api.net/mdd/Red3.png</a>', values: { shadow: 0, sword: 1, mana: 1, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Red4.png" rel="nofollow">http://roll20api.net/mdd/Red4.png</a>', values: { shadow: 0, sword: 2, mana: 1, shield: 0, unblockable: 0, monster: 0 } }, ] }, 'green': { name: 'Green Die', faces: [ { face: '<a href="http://roll20api.net/mdd/Green1.png" rel="nofollow">http://roll20api.net/mdd/Green1.png</a>', values: { shadow: 0, sword: 0, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Green2.png" rel="nofollow">http://roll20api.net/mdd/Green2.png</a>', values: { shadow: 0, sword: 0, mana: 0, shield: 1, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Green3.png" rel="nofollow">http://roll20api.net/mdd/Green3.png</a>', values: { shadow: 0, sword: 0, mana: 0, shield: 1, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Green4.png" rel="nofollow">http://roll20api.net/mdd/Green4.png</a>', values: { shadow: 0, sword: 0, mana: 0, shield: 1, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Green5.png" rel="nofollow">http://roll20api.net/mdd/Green5.png</a>', values: { shadow: 0, sword: 0, mana: 0, shield: 2, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Green6.png" rel="nofollow">http://roll20api.net/mdd/Green6.png</a>', values: { shadow: 0, sword: 0, mana: 0, shield: 3, unblockable: 0, monster: 0 } }, ] }, 'blue': { name: 'Blue Die', faces: [ { face: '<a href="http://roll20api.net/mdd/Blue1.png" rel="nofollow">http://roll20api.net/mdd/Blue1.png</a>', values: { shadow: 0, sword: 0, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Blue2.png" rel="nofollow">http://roll20api.net/mdd/Blue2.png</a>', values: { shadow: 0, sword: 0, mana: 0, shield: 0, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Blue3.png" rel="nofollow">http://roll20api.net/mdd/Blue3.png</a>', values: { shadow: 0, sword: 0, mana: 0, shield: 1, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Blue4.png" rel="nofollow">http://roll20api.net/mdd/Blue4.png</a>', values: { shadow: 0, sword: 0, mana: 0, shield: 1, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Blue5.png" rel="nofollow">http://roll20api.net/mdd/Blue5.png</a>', values: { shadow: 0, sword: 0, mana: 0, shield: 1, unblockable: 0, monster: 0 } }, { face: '<a href="http://roll20api.net/mdd/Blue6.png" rel="nofollow">http://roll20api.net/mdd/Blue6.png</a>', values: { shadow: 0, sword: 0, mana: 0, shield: 2, unblockable: 0, monster: 0 } }, ] } }; const PoolNameLookup = { shadow: 'Shadow', sword: 'Damage', mana: 'Mana', shield: 'Blocking', unblockable: 'Unblockable', monster: 'Monster' }; const DiceNameLookup = { 'b': 'blue', 'bk': 'enemy', 'e': 'enemy', 'g': 'green', 'o': 'orange', 'r': 'red', 's': 'shadow', 'p': 'shadow', 'y': 'yellow' }; const dieRegex = new RegExp(`^(\\d+)(${Object.keys(DiceNameLookup).join('|')})$`,'i'); const times = (n,f) =&gt; Array(n).fill(n).map(f); const roll = (t) =&gt; DicePools[t].faces[randomInteger(DicePools[t].faces.length)-1]; const rollN = (t,n) =&gt; times(n,()=&gt;roll(t)); const css = (o)=&gt;Object.keys(o).reduce((m,k)=&gt;`${m}${k}:${o[k]};`,''); const s = { box: css({ ["font-weight"] : "bold", ["border-bottom"] : "2px solid #0F3DA0", ["border-top"] : "4px solid #0F3DA0", ["background-color"] : "#AEB6C6" }), heading: css({ ["font-weight"] : "bold", ["font-size"] : "1.3em" }), row: css({ ["margin"] : ".1em", ["border-bottom"] : "1px solid #0F3DA0" }), stat_l: css({ ["min-width"] : "7em", ["font-weight"] : "bold", ["color"] : "purple", ["display"] : "inline-block", }), die: css({ ["display"] : "inline-block", ["margin"] : ".1em", ["font-size"] : "1.3em", ["max-width"] : "3em", ["border"] : "2px solid black", ["border-radius"] : ".25em", ["background-color"] : "white", ["color"] : "black", ["float"] : "left" }), clear: css({ ["clear"] : "both" }) }; const f = { content: (t,...c) =&gt; `&lt;div style="${s.content}"&gt;${f.heading(t)}${c.join('')}&lt;/div&gt;`, heading: (t) =&gt; `&lt;div style="${s.heading}"&gt;${t}&lt;/div&gt;`, box: (t) =&gt; `&lt;div style="${s.box}"&gt;${t}&lt;/div&gt;`, clear: () =&gt; `&lt;div style="${s.clear}"&gt;&lt;/div&gt;`, stat_l: (l) =&gt; `&lt;span style="${s.stat_l}"&gt;${PoolNameLookup[l]}:&lt;/span&gt;`, stat_v: (v) =&gt; `&lt;code&gt;${v}&lt;/code&gt;`, stat: (l,v) =&gt; `&lt;li style="${s.stat}"&gt;${f.stat_l(l)} ${f.stat_v(v)}&lt;/li&gt;`, stats: (ss) =&gt; `&lt;ul&gt;${Object.keys(ss).filter(k=&gt;ss[k]).map(k=&gt;f.stat(k,ss[k])).join('')}&lt;/ul&gt;`, die: (img) =&gt; `&lt;img style="${s.die}" src="${img}" /&gt;`, row: (...o) =&gt; `&lt;div style="${s.row}"&gt;${o.join(' ')}${f.clear()}&lt;/div&gt;` }; const formatOutput = (r,t) =&gt; { return f.content( t, f.row(...r.f.map(i=&gt;f.die(i))), f.stats(r.v) ); }; const processInlinerolls = (msg) =&gt; { if(msg.hasOwnProperty('inlinerolls')){ return msg.inlinerolls .reduce((m,v,k) =&gt; { let ti=v.results.rolls.reduce((m2,v2) =&gt; { if(v2.hasOwnProperty('table')){ m2.push(v2.results.reduce((m3,v3) =&gt; [...m3,(v3.tableItem||{}).name],[]).join(", ")); } return m2; },[]).join(', '); return [...m,{k:`$[[${k}]]`, v:(ti.length &amp;&amp; ti) || v.results.total || 0}]; },[]) .reduce((m,o) =&gt; m.replace(o.k,o.v), msg.content); } else { return msg.content; } }; on('chat:message',msg=&gt;{ if('api'===msg.type &amp;&amp; /^![w]?mdd(\b\s|$)/i.test(msg.content) &amp;&amp; playerIsGM(msg.playerid)){ let who = (getObj('player',msg.playerid)||{get:()=&gt;'API'}).get('_displayname'); let w=/^!w/.test(msg.content); let content = processInlinerolls(msg); let roll = content.split(/\s+/) .slice(1) .filter(e=&gt;dieRegex.test(e)) .map(e=&gt;e.match(dieRegex).slice(1,3)) .map(d=&gt;rollN(DiceNameLookup[d[1].toLowerCase()],parseInt(d[0]))) .reduce((m,r)=&gt;[...m,...r],[]) .reduce((m,r)=&gt;{ m.f.push(r.face); Object.keys(r.values).forEach(k=&gt;m.v[k]=(m.v[k]||0)+r.values[k]); return m; },{f:[],v:{}}) ; let out=formatOutput(roll,`Result &lt;a href="${content}"&gt;${content.replace(/^[^\s]* /,'')}&lt;/a&gt;`); sendChat('MDDice',`${w?`/w "${who}" `:''}${out}`); } }); });
1670211126
The Aaron
Roll20 Production Team
API Scripter
Oh, you can also use inline rolls to get the numbers, if that makes a difference: !mmd [[1d4+@{Bob|red}]]r
thank you so much for that .. would not have been able to write that...
its on the sheet and working ...&nbsp; you're brilliant... THANKS
1670228771
GiGs
Pro
Sheet Author
API Scripter
If you are adding it to a sheet, you might be better served by looking at custom roll templates and custom roll parsing. That way it will be available to everyone who uses the sheet, not just Pro users. That said, if the sheet is just for your own use, you can ignore this. Just continue using the script. You already have it and it will be a lot less work!
Atm.. it is for personal use... lots of work to get all components of the game in... and working! if it works well enough later.. i might see about letting others use it..