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 merry + bright! 🎄
Create a free account

Referencing drop-down selections in a roll template

Hello. I'm new to the forums but I have a problem with a character sheet I nearly have complete. It's a more detailed sheet for DWAITAS. With skills you can add in any of the attributes so as part of each button I have a drop-down selection for them. Right now when rolled the roll gives me the correct number results but I am trying to reference the name of the attribute selected as well to display it on the template output but all I get is the value. This is how I am doing the drop-down. {{attribute=?{Attribute|Awareness,@{awa}-@{awadmg}|Coordination,@{coo}-@{coodmg}|Ingenuity,@{ing}-@{ingdmg}|Presence,@{pre}-@{predmg}|Resolve,@{res}-@{resdmg}|Strength,@{str}-@{strdmg}}}} Example: When I roll Transport and select Awareness as the related attribute I get the correct numerical value of Awareness - Awareness Damage in the roll. I would also like to display the word "Awareness" instead of "4-1" in the template output of chat. I am not sure how to reference it. Let me know if there is any more info needed to help. Thanks in advance.  And, if I am posting in the wrong place please let me know.
1581304386
GiGs
Pro
Sheet Author
API Scripter
I love that roll template. Unfortunately you are hitting on one of the limitations of the roll20 dice. If you want to do it the way you are doing it now, you either need two drop downs, once to ask for the attribute name and another for the value, which is obviously not a good way. Another is to make a more complex dropdown, which will use html entity replacements, which is complex - see Advanced Queries for more. The easiest solution would be to put the attribute selection dropdown (a select) on the character sheet, not as part of the roll. When a player picks a value from the dropdown, a sheet worker can get the value of attribute and put it in a hidden attribute. Then the roll macro gets the attribute name from the select value, and the attribute value from the hidden attribute.
1581333551

Edited 1581334105
Thanks for the suggestions. I'm not afraid of digging into more complex macro technology so I may explore that just to learn how it works. However, for ease of setup I may opt for the on-sheet attribute select with worker to populate a hidden value field. That option will also let me easily calculate the attribute value, pre-roll as well since what's used in the roll is attribute value minus attribute damage. As a side issue I might also look into sheet workers to make an on-change script to cap the damage for each attribute. In the game you can't take more damage than you have value in the attribute. This would help me avoid negative numbers in attributes for rolls (though, while typing this I realize I could also drop negatives when storing the the value in the hidden field for the roll in that worker). You've been really helpful.