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

Problem with formula in template

1759686278
Narmo
Pro
Sheet Author
I'm trying to build a character sheet for a system that's quite mathematically complex. The idea is that Attributes range from 10 to 50. The roll is a d10, but the actual roll is 1d10 + (Attribute/10)d10. I managed to prepare the formula under the button: <input type="number" align="center" style="width:60%" name = "attr_char_sil" value="10" min="0" max="40"/> <button type='roll' style="width:60%;" name'roll_silCheck' value='/r [[?{Cecha|floor(@{char_sil}/10)+1]]d10}' data-i18n="SIŁ">SIŁ</button> However, this formula: (floor(@{char_sil}/10)+1)d10 doesn't work in the template (I want to display the results separately). Maybe you also have an idea how to mark the results without using the API: 1-6 is Failure 7-9 is 1 Success 10 is 2 Successes And then sum the successes It seems like Custom Roll Parsing would be helpful, but I can't to build it properly.
1759696437
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yep, custom roll parsing is what you want. You will need to build a roll template to use custom roll parsing. I recommend GiGs' blog for info on sheet building .
1759765303
Narmo
Pro
Sheet Author
Thanks, but first of all I need to make a formule of roll which will work in template. For now on it's work only out of template...
1759766276
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
The formula you have is pretty much what you want for use in the custom roll parsing. It's only displaying the individual results that you need the roll parsing for. Also, I'd recommend doing your roll development with a roll template instead of the /r command. There are some small differences in how they parse.
1759783841

Edited 1759783869
Narmo
Pro
Sheet Author
Yeah, but if I wrote this as that: <button type='roll' style="width:60%;" name'roll_silCheck' value='&{template:default} {{name=SIŁA Roll}} {{roll=[[(?{Cecha|floor(@{char_sil}/10)}+1)d10]]}}' data-i18n="SIŁ">SIŁ</button> Than it doeasn't work as roll: Maybe there is a mistake, but I didn''t see it...
1759786327
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yes, because you removed the inline roll brackets from around the calculation of the number of dice. It should be: [[[[?{Cecha|floor(@{char_sil}/10)}+1]]d10]]
1759793781
Gauss
Forum Champion
Narmo said: Yeah, but if I wrote this as that: <button type='roll' style="width:60%;" name'roll_silCheck' value='&{template:default} {{name=SIŁA Roll}} {{roll=[[(?{Cecha|floor(@{char_sil}/10)}+1)d10]]}}' data-i18n="SIŁ">SIŁ</button> Than it doeasn't work as roll: Maybe there is a mistake, but I didn''t see it... To elaborate on what Scott C. wrote,  (calculation)d10 is not going to be seen as a variable number of dice because the entire thing is seen at once (basically).  Inline brackets will tell the system to process what it inside first.  [[calculation]]d10 will be resolved as:  [[calculation]] then #d10 (where # is the result of the calculation)
1759850844
Narmo
Pro
Sheet Author
Thanks! Yeah, it's works when I replace "(" on "[[". I will never find it by myself!