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 .
×

[Help] Condition with select attributes

1444904651

Edited 1444908617
Hello, I'm trying to make some RyuuTama character sheet, and I have some problems : First of all : a character attribute is a dice, for d4 to d12 (never highter for PC), some status (checkboxes) can change the dice (d6 + 1 = d8, etc...), but d4-1 = d4 and d12+1 = d12, I don't realy find how to make this in my character sheet. The second thing is, a PC is defined by he's class and he's type, there are only 3 type (attack, specialist and magic) the type changes some stuff (max HP or MP bonus) is it possible to make some if statement in autocalculation to have something like " if(Type=="Attack",3,0) " ? For HP/MP : the formula is Attribute*3 (the number of faces of the dice), so it seems to be easier to assume an attribute is a value in the (4;6;8;10;12) number list and do math with it. And the last thing, but so far I saw, it doesn't look to be possible, a fumble is 1 on both dices, a critical is 4 for a d4, any in (6,8,10,12) on other dices, and both dices have to be on a critical face for it to be a critical, is it possible to make it automatic ?
1444908031

Edited 1445457865
Chris D.
Pro
Sheet Author
API Scripter
Compendium Curator
The good news is that so far as I can tell, everything you are trying to do is probably possible.&nbsp; The bad news is that these sheets can be very hard to do, and your first sheet will take forever as you learn what can and can't be done. and you constantly reinvent the wheel. What you are probably going to &nbsp;have to do is download one or two sheets for other games, and study them to see how they work.&nbsp; Yes, I think you probably want your attributes to be two or more parts. A select that gives a value of 4, 6, 8, 10, or 12. and I would think an integer modifier that might be positive, zero, or negative. That modifier might be calculated from the status of checkboxes. The way to turn a select into an autocalculation is via an autocalculated boolean number.&nbsp; Look at the following. &lt;select name="attr_Race" style="width:9em;" title="@{Race}"&gt; &lt;option value="1" selected title="Movement Rate 10, Karma Modifier 4, Heat Sight, Strong Back."&gt; Dwarf&lt;/option&gt; &lt;option value="2" title="Movement Rate 14, Karma Modifier 4, Low Light Vision."&gt; Elf&lt;/option&gt; &lt;option value="3" title="Movement Rate 12, Karma Modifier 5, Versatility."&gt; Human&lt;/option&gt; &lt;/select&gt; &lt;input type="number" name="attr_Race-Dwarf" &nbsp; value="(1-(((abs(@{Race}- 1 )+1)-abs(abs(@{Race}- 1 )-1))/2))" disabled /&gt; &lt;input type="number" name="attr_Race-Elf" &nbsp; &nbsp; &nbsp; &nbsp;value="(1-(((abs(@{Race}- 2 )+1)-abs(abs(@{Race}- 2 )-1))/2))" disabled /&gt; &lt;input type="number" name="attr_Race-Human" value="(1-(((abs(@{Race}- 3 )+1)-abs(abs(@{Race}- 3 )-1))/2))" disabled /&gt; &lt;span&gt;Movement: &lt;input name="attr_Movement" type="text" style="width:4em;" disabled value="((@{Race-Windling}*6)+((@{Race-Dwarf}+@{Race-Obsidiman})*10)+((@{Race-Human}+@{Race-Ork}+@{Race-Tskrang})*12)+((@{Race-Elf}+@{Race-Troll})*14)+@{Misc-Movement-Mods})" title="@{Movement}: Races normal Movement Rate." &gt;&lt;/span&gt; First we have a SELECT, where if they choose Elf, it gets turned into a 2. Then we have three different checkboxes where only one will be true. If Race == 2, then Race-Elf will have a value of 1 (true), everything else will have a value of zero (false) You will probably want these boolean fields to be style="display: none;" Then we use Race-Elf in math. If Race-Elf is 1, then Race-Elf * 14 will equal 14. Otherwise it will equal zero.&nbsp; If needed, we can extend it to adding a checkbox and&nbsp;attach a class to it and have css do stuff. &lt;input class="Elf" type="checkbox" name="attr_Race" value="2" /&gt; Note that this checkbox has the exact same name as the original SELECT statement.&nbsp; If the value of the select is 2, then THIS check box (with class elf) is checked. &nbsp;&nbsp;You probably want these checkboxes to also be display: none; This will allow css tests of the form .sheet-Elf:not(:checked)~.sheet-Elf-section, The dice reference&nbsp; <a href="https://wiki.roll20.net/Dice_Reference" rel="nofollow">https://wiki.roll20.net/Dice_Reference</a> will get you started on your last question.&nbsp; if you have two dice,than a roll of 2 is a critical fumble&nbsp;/roll 2d8cf&lt;2 If you have 2d8, then a roll of 16 is a critical success /roll 2d8cs&gt;16 If you have 1d6 and 1d8, then a roll of 14 is a critical success /roll 2d8cs&gt;14 Note that the default display does not SAY anything about criticals or fumbles, so you may have to use an advanced display option.&nbsp; Good luck.
thanks, I didn't even thought about using the solution you showed to emulate an if behaviour, that's brillant, and it sound so obvious now -_-; I'll implement that.
1444912906
Chris D.
Pro
Sheet Author
API Scripter
Compendium Curator
I did not come up with any of this myself. It is all borrowed from others.&nbsp; If you have not yet read the "CSS Wizardry" sticky thread at the top of this section, do so. It has many great tricks.&nbsp;
I have some issue with my rolls : this is what I use to setup my rolls &lt;div&gt;&lt;button type="roll" value="/roll 1d[[@{Vigueur-Actuel}]]" name="roll_Vigueur"&gt;Vigueur&lt;/button&gt;&lt;br /&gt; &lt;select name="attr_Vigueur" title="Valeur de base" value="4"&gt; &lt;option value="4"&gt;d4&lt;/option&gt; &lt;option value="6"&gt;d6&lt;/option&gt; &lt;option value="8"&gt;d8&lt;/option&gt; &lt;option value="10"&gt;d10&lt;/option&gt; &lt;option value="12"&gt;d12&lt;/option&gt; &lt;/select&gt; &lt;input type="checkbox" name="attr_BonusConditionVigueur" value="2" /&gt; &lt;div&gt; &lt;input type="Number" name="attr_VigueurModifiee" value="(@{Vigueur}+@{BonusConditionVigueur})" disabled="true" /&gt; &lt;input type="Number" name="attr_VigueurD4E1" value="(2*((-(@{VigueurModifiee}-3)+abs(@{VigueurModifiee}-3))/(abs(@{VigueurModifiee}-3)*2)))" disabled="true" /&gt; &lt;input type="Number" name="attr_VigueurD4" value="(@{VigueurD4E1}*(4-@{VigueurModifiee})/2)" disabled="true" /&gt; &lt;input type="Number" name="attr_VigueurD12E1" value="(2*(((@{VigueurModifiee}-13)+abs(@{VigueurModifiee}-13))/(abs(@{VigueurModifiee}-13)*2)))" disabled /&gt; &lt;input type="Number" name="attr_VigueurD12" value="(@{VigueurD12E1}*(12-@{VigueurModifiee})/2)" disabled /&gt; &lt;input type="Number" name="attr_Vigueur-Actuel" value="@{VigueurModifiee}+@{VigueurD4}+@{VigueurD12}" disabled /&gt; the problem is that : when Vigueur is set to 12, and BonusConditionVigueur is checked &nbsp;: Vigueur-Actuel box displays 12 (what I want) but any roll of this value issues 14 (not what I want). I don't understand what's happening
1445028095
Chris D.
Pro
Sheet Author
API Scripter
Compendium Curator
One important thing to remember is that what you are seeing is not actually what the program is seeing.&nbsp; I copied your code fragment above and ran it and saw what you were describing. Then I added the following line.&nbsp; &lt;input name="attr_Vxxx" type="text" value="/roll 1d[[@{Vigueur-Actuel}]]" disabled /&gt; Which is to say, show us what&nbsp;@{Vigueur-Actuel} is as text, rather than a number. This is what I got with the box checked. (says rolling step 14) /roll 1d[[(12+2)+((2*((-((12+2)-3)+abs((12+2)-3))/(abs((12+2)-3)*2)))*(4-(12+2))/2)+((2*((((12+2)-13)+abs((12+2)-13))/(abs((12+2)-13)*2)))*(12-(12+2))/2)]] &nbsp;&nbsp; And this is what I got when the box was not checked.&nbsp;(says rolling step 12 ). 1d[[(12+0)+((2*((-((12+0)-3)+abs((12+0)-3))/(abs((12+0)-3)*2)))*(4-(12+0))/2)+((2*((((12+0)-13)+abs((12+0)-13))/(abs((12+0)-13)*2)))*(12-(12+0))/2)]] so what you were getting was ether 1d(12+2) or 1d(12+0) There are two things you want to fix. First, in attr_Vigueur-Actuel, put an () around the value just inside the quote marks.&nbsp; As you have probably noticed, that makes it produce an error when the button is rolled.&nbsp; SyntaxError: Expected [0-9] but "(" found. That is because attr_Vigueur-D12E1 has a bug. It has an ((-( which is not legal. For some reason the system was trying to interpret it, and got some sort of answer, except when Vigueur-Actuel has parens around its value. So fix that bug and everything ought to work.&nbsp;
thanks, now it works, I can got further in my character sheet