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

Custom System: Number value to get dice rolls

A buddy of mine is developing his Own system, and one of the core mechanics is computing a Dive Value (DV) and then useing that value, roll a number of dice. Skill + Attribute = DV So in a nutshell: 1 = D2 2 = D4 3 = D6 ....... 6 = D12 7 = D10+D4 8 = D10+D6 ... 13 = D12+D10+D4 etc... So I'm wanting to create sheets for use in game, but I'm having a heck of a time trying to get this system to work. I'm not nearly as fluent in HTML/JS as i though i was. What would be the easiest way to accomplish this? I'm thinking a JS script switch in the <scripts> section of the sheet, but i cant figure out how to pass the data back to the roll template I'm using. Another though was to use a hidden input selector, but i can get it to work (Similar to the <fieldset class="repeating_skills"> example. Any help here would be GREATLY appreciated. Thanks all!
1492634025
Lithl
Pro
Sheet Author
API Scripter
Jarrod S said: I'm thinking a JS script switch in the <scripts> section of the sheet, but i cant figure out how to pass the data back to the roll template I'm using. Set the value of a hidden attribute with your sheet worker script, and then reference that attribute with your roll button.
1492634383

Edited 1492634901
So like this: <button type='roll' value='/roll @{DiceValue}' name='roll_Skill'> switch( DiceValue ) { case 13 : D12+D10+D4 break; }
1492640101
Lithl
Pro
Sheet Author
API Scripter
More like: on('sheet:opened change:example_skill change:example_attribute', function() { getAttrs(['example_skill', 'example_attribute'], function(values) { var diceValue = parseInt(values.example_skill) + parseInt(values.example_attribute); switch (diceValue) { case 13: diceValue = 'd12+d10+d4'; break; // etc. } setAttrs({dice_value: diceValue}); }); }); <button type="roll" value="/roll @{dice_value}" name="roll_skill"></button>
Awesome! Thanks
Using your above code, I'm getting: No attribute was found for @{Tester|dice_value} I also added an input to get the values: <label>Example</label><br> Example Skill: <input type="number" min="0" step="1" name="attr_example_skill" /><br> Example Attr Bonus: <input type="number" min="0" step="1" name="attr_example_attribute" /><br> <button type="roll" value="/roll @{dice_value} + @{example_attribute}" name="roll_example_skill"> Skill </button> Any ideas?