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 Sheet) Converting formula into numeric value.

1612006782

Edited 1612007009
Hello All, I've been using a custom Prof bonus of value="ceil((@{level})/5)" for my sheet. However, I now use the bonus is some e.g. I want to multiply the bonus and use the result as an amount of dies e.g. [[(Prof*2)d6]]. However since the formula pulls @{prof} as ceil((@{level})/5) it doesn't work no matter how I structure the formula always resulting in "formula = ceil((@{level})/5)*2 [ignoring the d6]. I've noticed that in Roll20 5e sheet Prof is a straight numeric value. I've been digging in the code but I couldn't find solution in there. Thanks in advance. edit: As an extreme measure I can just do a drop down for levels and assign prof value to each level individual, but its not very clean.
1612010981
GiGs
Pro
Sheet Author
API Scripter
the 5e sheet most likely uses a sheet worker to calculate the value, whereas you're using an autocalc. Sheet workers are much better than autocalcs in all ways except easy of creation, and they are much more complicated to create. See the wiki for more. That said, can you show the html you're using? You should be able to use an autocalc for your purpose. Here's a method that might work. Create an attribute like <input type="hidden" name="attr_prof" value="ceil(@{level}/5)" disabled="true" > Than you can use it in other autocalc fields just by referencing @{prof} To replace this (which isnt good syntax):  [[(Prof*2)d6]] you can try ([[@{prof}]]*2)d6
Oh yeah I'm doing reference in a form of @{prof}. The problem was that it would straight up take the ceil((@{level})/5) value and do not pre-calculate it, just throw it in the formula. But I see something in your second example that I didnt know was possible, a formula in formula so [[ x [[ y ]] ]], in this case it actually works if I put ceil((@{level})/5) inside separate [[ ]]. Though the formula is pretty messy if you hover over the outcome. This should work as is for me, for now. Thanks a lot.
1612014585

Edited 1612014641
GiGs
Pro
Sheet Author
API Scripter
Inline roll brackets [[ ]], and sometimes even well-placed normal brackets ( ), are great at making autocalcs function, but yes, they do produce pretty ugly output. You can nest inline rolls quite deep. At some point though its a good idea to investigate sheet workers. They make so many things more possible.