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 .
×
May your rolls be chill this holiday season!
Create a free account

Getting the Text of a Selected Option

So, I want to put the value of a selection (a modifier to a dice roll) and the text of that selection into an emote. For example I have a combat modifiers selection (dropdown) of three options. <div class="sheet-item sheet-smaller"> <select name="attr_ranged-attack-range"> <option value="0" selected>Short</option> <option value="-20">Long</option> <option value="-30" title="Requires a Half Action of Aiming">Extreme</option> </select> </div> The value here would be used to modify an attribute prior to rolling. The text (text node for HTML/XML/SGML nerds) would be used in the emote, i.e., selecting Long would present: /me fires his "selected-weapon" at "Long" range\n\n/roll d100<@{ballistics}-@{ranged-attack-range} Thoughts? Examples would be very helpful. And requiring that an Aim attribute be checked when selecting Extreme Range (in the above example) would also be a good example to see. I've seen the use of hidden fields that perform some sort of prerequisite checking (due how the character sheet is saved by a player), but I can't find documentation on using these. Examples would be helpful here as well.
1424119765
Lithl
Pro
Sheet Author
API Scripter
Not possible, unfortunately.
1424168682
Finderski
Plus
Sheet Author
Compendium Curator
Brian, would there be a way to use the value of the select in a hidden to field to show/hide different buttons? So, in this case, while not optimal, you could set up three different buttons, one for short, one for long, an done for extreme and then based on the value of the select, hide all the buttons except the appropriate one? For example I've used this: .sheet-usePieces input[value="2"]:checked ~ label.sheet-Money::before { content: "Clams:"; } Could we do something like: <select name="attr_ranged-attack-range"> <options> </select> <input type="text" name="attr_ranged-attack-final" class="sheet-rangedattack" value="@{ranged-attack-range}" style="display:none;"/> <button type="roll_ranged-attack-short" value="stuff short stuff"></button> <button type="roll_ranged-attack-long" value="stuff long stuff></button> <button type="roll_ranged-attack-extreme" value="stuff takes a half action to aim and shoots at extreme stuff"></button> And then use CSS to determine which button show based on attr_ranged-attack-final?
1424187185
Lithl
Pro
Sheet Author
API Scripter
Yes, you could swap out what button is displayed based on a checkbox or radio button (I believe one of the oWoD sheets does this) to effectively change the button's behavior. However, if the player drags the button to their macro bar, the substitution won't affect it, and you chan't make the switch based on a select dropdown.
G V. with another look at what is possible with a lot of creativity in hacking around limitations of the DOM and Runtime contexts exposed by Roll20. :) I'm not sure I would want invest this sort of effort simply for an emote. But I'm intrigued.
1424284195
Finderski
Plus
Sheet Author
Compendium Curator
LOL - Thanks Timothy. I get lucky occassionally. :)