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

Dynamic attribute in roll

Hey everyone, I'm currently working on a custom sheet, and have some issue on a specific roll button. I'd like to use, as a property for this roll, an attribute value based on another one. Here's an example : <input type="number" name="attr_Strength" /> <input type="hidden" name="attr_attribute_name" /> <button type="roll" name="roll_Example" value="&{template:example} {{prop=@{@{attribute_name}}}}"></button> If attr_Strength input is "12", and attr_attribute_name is "Strength", requested behaviour would be to roll with parameter prop equals to 12 : prop = @{@{attribute_name}} prop = @{Strength} prop = 12 I tried a few suggestions I read on the forum and elsewhere, like using html code instead of @{}, but nothing works. I get the following error or a variant : No attribute was found for @{JohnDoe|@{attribute_name} Thanks for your help !
1597090128
GiGs
Pro
Sheet Author
API Scripter
What you're trying to do is possible, but not in the way you are trying. You can never do @{@{ - attribute calls can not be constructed dynamically (there are exceptions, but they are tricky, but for your goal, they are not relevant). How do you choose which attribute is used on the task? It's hard to know which method to recommend without knowing this. But note that an attribute can refer to another attribute. So, if you have a way to assign the strength attribute to your hidden attribute_name, you can just do {{prop=@{attribute_name} }}
It worked perfectly fine with this suggestion ! Thank you very much !