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

Displaying Auto-Calculating Values in inline text

October 30 (5 years ago)

I'm currently working on some automated calculation of dice on my sheet and get into problems when I try to display them in inline text.

my code currently looks like this:

<input type="hidden" disabled="true" name="attr_str_dice" value="...maths and stuff..." />
Strength<span name="attr_str_dice"></span> <input type="text" autocomplete="off" name="attr_str" value="1">

The value for attr_str_dice is calculated correctly and can be used in rolls but the <span> element just displays the formula in plaintext.

Is there a way to fix this or should I just change the input to text and do some css surgery until it looks right?

October 30 (5 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator


Discord said:

The value for attr_str_dice is calculated correctly and can be used in rolls but the <span> element just displays the formula in plaintext.

Is there a way to fix this or should I just change the input to text and do some css surgery until it looks right?

Unless you change how the sheet shows the `<span>` it does exactly as it's told and just shows it in plaintext.


Assuming you want the autocalculated field to look similar to the input number, you just have to set the span to have same widths, heights, font-size etc. as the input is using.


My Feast of Legends sheet should be an simple enough example that you can figure out how you could do it. If you look at the stats, the first column is where you input the stats, and the second column shows the resulting mod for the stat. You need to look at both the html & css.

October 30 (5 years ago)


Andreas J. said:

Unless you change how the sheet shows the `<span>` it does exactly as it's told and just shows it in plaintext.

It's not about the look of the object. I want it to display the calculated value but it shows the formula instead