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

Better way to display variables computed during a roll

1642940334

Edited 1642940748
Hi! I wrote some dice rolling code for a new character sheet. I have have some things that are computed within the body of the startRoll function, for example how much strain the caster took while casting the spell - which depends on how they rolled. I want to display that information in the roll template I made. My code can do that right now but I don't think I am doing it correctly. In the roll formula I specify a new dummy roll (within the bigger roll formula): {{casterStrain=[[0d0]]}} Start a roll: startRoll(rollFormula, (results) => { [...] I compute the value of the strainTaken variable Within the finishRoll function I override the dummy roll result with my custom value: finishRoll(results.rollId, {casterStrain: strainTaken}); Then I display it in the roll template: <p>It caused <b>{{computed::casterStrain}}</b> to the caster</p> but, since it is defined as a roll, it is displayed in the yellow box and you can hover over it to see the 0d0 dummy roll. I suppose it wouldn't be the most terrible thing in the world to leave it like this, but I don't like it. So my question is: is there a better way of displaying a value computed during a roll in the roll template? - Or is this the only way to do this? I tried {{casterStrain=[[]]}} or {{casterStrain=""}} and similar, but neither worked.
1642941652

Edited 1642941749
Finderski
Plus
Sheet Author
Compendium Curator
Are you using a custom roll template for your output, or the default one provided by Roll20? If a custom one, you can use CSS to modifier the dice rolls output. You'd want to modify the following classes: inlinerollresult, inlinerollresult.fullcrit, inlinerollresult.importantroll, and inlinerollresult.fullfail. You'd essentially want to make sure they don't have a background color, make the font color appropriate for the text output your inserting this into, and no borders, etc. Here's an example for a roll template for a sheet I did. The roll template is called consumables. .sheet-rolltemplate-consumables .inlinerollresult, .sheet-rolltemplate-consumables .inlinerollresult.fullcrit, .sheet-rolltemplate-consumables .inlinerollresult.fullfail, .sheet-rolltemplate-consumables .inlinerollresult.importantroll { background-color: transparent; border: none; padding: 0; font-size: 1em; font-weight: bolder; font-style: italic; }
I am using a custom template. Okay so from what I understand from you answer, this IS the correct way to do it, I can just remove the standard roll styling with CSS