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

Drop-Down Menu Calc-Format Assistance

This is Q1, of the 4-part post I originally made here:&nbsp; <a href="https://app.roll20.net/forum/post/6888292/roll20-html-assistance/?pageforid=6888531#post-6888531" rel="nofollow">https://app.roll20.net/forum/post/6888292/roll20-html-assistance/?pageforid=6888531#post-6888531</a> I've tried formatting my sheet's drop-down menu various ways (&amp; I mean a LOT of various ways; e.g. bracket positions, operator positions, etc.), but can't seem to get it to calculate correctly. Any suggestions? Here is how it currently looks, &amp; latter, what I'm trying to accomplish: &lt;select name="attr_equiploc"&gt; &nbsp; &nbsp; &nbsp;&lt;option value="armornone"&gt;None&lt;/option&gt; &nbsp; &nbsp; &nbsp;&lt;option value="((@{reflex}-3)+@{prof_lightrank})"&gt;Light&lt;/option&gt; &nbsp; &nbsp; &nbsp;&lt;etc.&gt; There is a stat called "Reflex", which is basically AGI, &amp; wearing armor which a player has no skill for incurs a penalty. This penalty is offset by the rank they hold in skill of the armor they are wearing. So... since light armor normally reduces a player's Reflex by 3, the penalty will be offset (reduced) by the amount of ranks they have in their light armor skill, (up to 3, since that is the cap of all combat skills). As it is currently formatted, (&amp; out of the dozens of other combinations I've tried), I cannot seem to get Roll20 to calculate this correctly... where... when I test the drop-down menu, none of the sheet's stats (e.g. Reflex) reflect the change. When I've done simpler calculations, on other drop-down menus, it has calculated correctly. Is this strange phenomena due to Roll20's inability to calculate more advanced formulas in drop-down menus, or am I missing something?
Try adding double brackets around the calculation to make it resolve to a value. &lt;option value=" [[ (@{reflex}-3)+@{prof_lightrank} ]] "&gt;Light&lt;/option&gt;
I think I tried that... but I'll give it another go. Thx
1539659259
GiGs
Pro
Sheet Author
API Scripter
If you want to ensure the penalty maxes out at 0 (so levels above 3 for example dont give a bonus) you should use the drop highest syntax: &lt;option value=" [[ { @{reflex}-3+@{prof_lightrank} , 0}dh1]] "&gt;Light&lt;/option&gt;
Got it man. Thx. I'm sure I've tried your suggestion before, but I found my mistake. Siiiiiiiiiiiiiiiiiiiiiiiiiiiigh... I was "victimized", lol, (again), by a misplaced ")" bracket on one of my calculation lines. I'm sorry for the inconvenience, but thx for your time &amp; input.&nbsp;
Just saw your suggestion GG. Thx a lot man. I can prolly use your suggestion in a few places :-D
The attributes involved in the calculation must have values, and cannot be autocalc values (disabled inputs). If they need to be calculated from other attributes, you need to use a sheetworker.
1539660588
GiGs
Pro
Sheet Author
API Scripter
I've done some testing, and i cant get the calculation to take place either. What did work was adding an input like so: &lt;select name="attr_equiploc_option"&gt; &nbsp; &nbsp; &nbsp;&lt;option value="0"&gt;None&lt;/option&gt; &nbsp; &nbsp; &nbsp;&lt;option value="@{reflex}-3+@{prof_lightrank}"&gt;Light&lt;/option&gt; &lt;/select&gt; &lt;input name="attr_equiploc" value='@{equiploc_option}' disabled="true"&gt; I couldnt get the keep lowest/drop highest function to work for some reason. Note: you want to set the none to 0 instead of armournone, if you you plan to use the output as an actual number.
1539661548
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yep, you can't do autocalc in selects, only an input. Also, GG, your input is missing a type (should be type=number).
1539661944

Edited 1539662112
Ares
Pro
I resolved my issue by dropping the more complex calc for one which only adds the armor skill rank against the penalty for wearing it unskilled: e.g. &lt;option value="[[@{prof_lightrank}-1]]"&gt;Light&lt;/option&gt; In my "Reflex" cell (which displays all of the info I wanted), I have the calc: value="[[floor((@{agi_score})/2)+@{equipprof}]]" which, as you can guess, saves me the frustration of trying to get the calc to work in the drop-down option (which I see Scott's explanation for now, thx for that). Thx for you guy's comments on this.