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

Character Sheet Dropdown that references a macro

Hi all, I had a look through the forum, but couldn't find anything that matched the scenario I was trying to create. Hope someone can offer some advice :) I have a long list of spells. And a character can choose a number of these each session. So having to write the details of the spell each session in their sheet is really time consuming. I want to have a dropdown on the character sheet, with all the spells as options. Each option has a value of a macro. I have a character entity with a spells menu macro that outputs to the chat menu, and a macro for each of the spells. I will have a button next to the dropdown, so that when they click it, it will trigger the macro - which has a roll template to output the spell info in the chat menu. The part I'm stuck on, is how to reference the macro in the dropdown so that 1) the dropdown shows the macro name and 2) when i click the button it can get the value of the macro from the dropdown and run it. Many thanks in advance!
The only other idea I have, is to have a field on the sheet for every field passed to the roll template by the macro. Then when a player selects an option in the select element, a sheet worker sets the values of those fields based on the option selected. And then clicking a button can just directly call the roll template with the values from the fields, that the macro would have done. However...this means having a sheet worker with a LOT of option values to check, and 4/5 field values listed for each one that needs setting. It's much better being in a macro, as this call also be utilised from within the chat menu...or on player tokens etc...
1606233005

Edited 1606234122
This is the sort of thing I've been trying... <select name="attr_Slot1">                             <option value="" selected disabled hidden>Choose here</option>                             <option value="GuidingLightAvana">GuidingLightAvana</option>                             <option value="BalmLordsSerenity">Balm of the Lords of Serenity</option>                             <option value="BlessingLordsLightDarkness">Blessing of the Lords of Light and Darkness</option> </select> <button class="sheet-skill-button" type="roll" value="%{Prayers|@{Slot1}}" title="."><span class="sheet-die">i</span></button> So...this works perfectly if I pass: %{Prayers|GuidingLightAvana} however, passing the attribute value as @{Slot1} encounters a problem: -
1606235731

Edited 1606236004
Andreas J.
Forum Champion
Sheet Author
Translator
Hm, at least by the Order of operations, that should check out: <a href="https://wiki.roll20.net/Dice_Reference#Order_of_Operations" rel="nofollow">https://wiki.roll20.net/Dice_Reference#Order_of_Operations</a> Edit: The roll button doesn't have a name, add name="roll_Slot1" to it, and you can then reference %{charactername|Slot1} as a form the sheet. But don't know if you can reference another ability/character sheet roll inside of each-other, so you might need to construct this in another way.
Thanks for the help. You're right though, you can't seem to reference an ability from within another roll. It's frustrating how close I am. The chat displays the correct value for Slot1, but the macro call doesn't. Is there a way I can trigger a Sheet Worker with the button, and use the value to call a macro?
I managed to solve it with help from Vince. &lt;input type="hidden" name="attr_call_macro" value="%{" /&gt; &lt;button class="sheet-skill-button" type="roll" value="@{call_macro}Prayers|@{Slot1}}" title="."&gt;&lt;span class="sheet-die"&gt;i&lt;/span&gt;&lt;/button&gt; Storing the value in a hidden attribute. And appending it to the roll button call.