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

Changing attributes used based on options (Help)

1546178666

Edited 1546186125
sHey, so I am creating my own character sheet for a game, and I was making a "Moves" System On the game we will have 5 stats, 3 of which(Strength, Intelligence and Dexterity) are used as "Damage modifiers" I was wondering if there's a way to set up a roll button that changes which stat will be used as damage modifier, selecting it first on a options div, and then changing the damage modifier based on the option selected. Here is the code so far for the move section             <fieldset class="repeating_pamoves"> <!-- Beginning of moves -->     <input type="text" name="attr_aamovename" placeholder="Move Name" style="movename"> <!-- Move Name --> <div class="2colpror"> <div class="col"> <!-- Main Roll --> <button class="moveroll" type="roll" style="margin-right:1px;" name="roll_move" value='&{template:default} {{name= @{aamovename}}} {{Tier= @{aamovetier}}} {{Description= @{aamovedesc}}} {{Damage= [[(0.80+[[1d20]])*@{aamovedamage}*{@aaattr}]] @{aamovetype} Damage}} {{Acccuraccy= @{aamoveaccuraccy}+@{acc}}} {{Acc. Roll= [[1d100]]}}'> </button> </div> <div class="col"> <!-- Tier Selector --> <select name="attr_aamovetier" class="aamovetier"> <option value="Unique">Unique</option> <option value="Tier 5">Greater</option> <option value="Tier 4">Major</option> <option value="Tier 3">Normal</option> <option value="Tier 2">Minor</option> <option value="Tier 1">Lesser</option> </select> </div> </div> <span>Compress</span><!-- Checkbox to hide everything below --> <input type="checkbox" class="movetest"> <div class="moveattack"> <div> <p>Move Power</p> <input type="number" name="attr_aamovedamage" placeholder="1.25"> <div class="separator"></div> <p>Damage Type</p> <select class="hiding class" style="text-align:center;" name="attr_aamovetype"> <option value=""></option> <option value="Fire">Fire</option> <option value="Grass">Grass</option> <option value="Water">Water</option> <option value="Ice">Ice</option> <option value="Electric">Electric</option> <option value="Fighting">Fighting</option> <option value="Ground">Ground</option> <option value="Flying">Flying</option> <option value="Rock">Rock</option> <option value="Psychic">Psychic</option> <option value="Bug">Bug</option> <option value="Dragon">Dragon</option> <option value="Steel">Steel</option> <option value="Fairy">Fairy</option> <option value="Dark">Dark</option> <option value="Ghost">Ghost</option> <option value="Normal">Normal</option> </select> <div class="separator"></div> <p>Move Accuraccy</p> <input type="number" name="attr_aamoveaccuraccy" placeholder="75"> <div class="separator"></div> <p>Damage Modifier</p> <!-- Attribute Selector --> <select class="hiding class" style="text-align:center;" name="attr_aaattr"> <option value-"0">0<option> <option value-"@{str}">Str</option> <option value-"@{int}">Int</option> <option value-"@{dex}">Dex</option> </select> </div> <div class="separator"></div> <!-- Description --> <textarea placeholder="Description" name="attr_aamovedesc"></textarea> </div> </fieldset> So this was my unsuccesful test: So what I thought would happen is it would read from the damage modifier selection, would read the attr_str/int/dex values that already exist, and roll it as a value on the dice roll, but instead it just seems to ignore it. What should I do?                         <p>Damage Modifier</p> <!-- Attribute Selector --> <select class="hiding class" style="text-align:center;" name="attr_aaattr"> <option value-"0">0<option> <option value-"@{str}">Str</option> <option value-"@{int}">Int</option> <option value-"@{dex}">Dex</option> </select>                         <button class="moveroll" type="roll" style="margin-right:1px;" name="roll_move" value='&{template:default}                              {{name= @{aamovename}}}                              {{Tier= @{aamovetier}}}                              {{Description= @{aamovedesc}}}                              {{Damage= [[(0.80+[[1d20]])*@{aamovedamage}*@{aaattr}]] @{aamovetype} Damage}}                              {{Acccuraccy= @{aamoveaccuraccy}+@{acc}}}                              {{Acc. Roll= [[1d100]]}} />
1546185199
Kraynic
Pro
Sheet Author
I would have thought your first one would work, but I am NOT one to help with sheet building.  I am barely capable of editing a simple existing sheet.  However, isn't there an error in the macro your roll button calls? @{aamovedamage}*{@aaattr} Specifically that part.  Shouldn't it instead be: @{aamovedamage}*@{aaattr}
Kraynic said: I would have thought your first one would work, but I am NOT one to help with sheet building.  I am barely capable of editing a simple existing sheet.  However, isn't there an error in the macro your roll button calls? @{aamovedamage}*{@aaattr} Specifically that part.  Shouldn't it instead be: @{aamovedamage}*@{aaattr} Thank you for noticing! So I changed it to the correct syntax, but even then it doesn't interpret the @{str} or other stats, it simply displays them as text and doesn't multiply properly on the roll. Anyone has a clue why? should i do it some other way?
1546188727
GiGs
Pro
Sheet Author
API Scripter
Try putting @{aaattr} in inline roll brackets, like @{aamovedamage}*[[@{aaattr}]]
1546188926
vÍnce
Pro
Sheet Author
Your option lines aren't using "="  You also might want to set the default with "selected" <select class="hiding class" style="text-align:center;" name="attr_aaattr"> <option value = "0" selected>0<option> <option value = "@{str}">Str</option> <option value = "@{int}">Int</option> <option value = "@{dex}">Dex</option> </select> Do your str, int, and dex attributes have values somewhere else in the code?  Do you get a value if you call them directly in chat? ie "@{selected|str}"
Vince said: Your option lines aren't using "="  You also might want to set the default with "selected" <select class="hiding class" style="text-align:center;" name="attr_aaattr"> <option value = "0" selected>0<option> <option value = "@{str}">Str</option> <option value = "@{int}">Int</option> <option value = "@{dex}">Dex</option> </select> Do your str, int, and dex attributes have values somewhere else in the code?  Do you get a value if you call them directly in chat? ie "@{selected|str}" Jesus, that was a big oversight, don't know how I didn't catch that. Fixing the "=" made the formula work, which was a sweet surprise. Thank you very much for the help!
1546207170
vÍnce
Pro
Sheet Author
Luka Maverick said: Vince said: Your option lines aren't using "="  You also might want to set the default with "selected" <select class="hiding class" style="text-align:center;" name="attr_aaattr"> <option value = "0" selected>0<option> <option value = "@{str}">Str</option> <option value = "@{int}">Int</option> <option value = "@{dex}">Dex</option> </select> Do your str, int, and dex attributes have values somewhere else in the code?  Do you get a value if you call them directly in chat? ie "@{selected|str}" Jesus, that was a big oversight, don't know how I didn't catch that. Fixing the "=" made the formula work, which was a sweet surprise. Thank you very much for the help! Been there. Done that. Too many times to mention. ;-P