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

Variable roll dice sides

1432170125

Edited 1432170207
Alberto E.
Sheet Author
Hi. Im doing a custom template for a Spanish game. It's almost finished, but Im finding some troubles with dice automation. What I want to do: An attritube has stored a numeric value with the sides of the dice to roll (ie: 4 for 1d4). I want to do a roll with this value + 2 (ie: 1d6). The problem I'm facing: /roll 1d@{Car}+2 = /roll 1d4+2 /roll 1d@{Car+2} = error If I use a hidden input to calculate it in another field, it will work the same way. The code I have: <select name="attr_Car" style="width: 12em;display:inlineblock;"> <option value="4">Poco apto (1D4)</option> <option value="6">Normal (1D6)</option> <option value="8">Destacado (1D8)</option> <option value="10">Excelente (1D10)</option> <option value="12">Insuperable (1D12)</option> </select>
1432186875
vÍnce
Pro
Sheet Author
Alberto E. said: Hi. Im doing a custom template for a Spanish game. It's almost finished, but Im finding some troubles with dice automation. What I want to do: An attritube has stored a numeric value with the sides of the dice to roll (ie: 4 for 1d4). I want to do a roll with this value + 2 (ie: 1d6). The problem I'm facing: /roll 1d@{Car}+2 = /roll 1d4+2 /roll 1d@{Car+2} = error If I use a hidden input to calculate it in another field, it will work the same way. The code I have: <select name="attr_Car" style="width: 12em;display:inlineblock;"> <option value="4">Poco apto (1D4)</option> <option value="6">Normal (1D6)</option> <option value="8">Destacado (1D8)</option> <option value="10">Excelente (1D10)</option> <option value="12">Insuperable (1D12)</option> </select> Maybe try a nested inline roll [[1d[[@{Car}]]+2]] or even add a query [[1d[[@{Car}]]+?{Modifier?|0}]]
1432188328
Lithl
Pro
Sheet Author
API Scripter
Vince said: Maybe try a nested inline roll [[1d[[@{Car}]]+2]] or even add a query [[1d[[@{Car}]]+?{Modifier?|0}]] The problem isn't using an attribute to select the die size: 1d@{Car} works perfectly fine. The problem is calculating a die size based on an attribute. That said, inline rolls still solve the problem: /roll 1d[[@{Car} + ?{Modifier|0}]] or [[1d[[@{Car} + ?{Modifier|0}]]]] should both work.
Brian said: Vince said: Maybe try a nested inline roll [[1d[[@{Car}]]+2]] or even add a query [[1d[[@{Car}]]+?{Modifier?|0}]] The problem isn't using an attribute to select the die size: 1d@{Car} works perfectly fine. The problem is calculating a die size based on an attribute. That said, inline rolls still solve the problem: /roll 1d[[@{Car} + ?{Modifier|0}]] or [[1d[[@{Car} + ?{Modifier|0}]]]] should both work. You are right, the problem is that. Vince solution doesnt work, it still does 1d4+2 as result Brian solution gives following error: Could not determine result type of: [{"type":"M","expr":1},{"type":"C","text":"d[[4 + 2]"}] Also, I would like to avoid using ?{Modifier}, the whole automatization is made to avoid the input of this value
Nvm, /roll 1d[[@{Character|Vol}+2]] works, I might had make a mistake when typing. Ty very much , both of you!