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

Calling Macro from Sheet Worker

Is there a way I can trigger a Sheet Worker with an action button, and use the value of a select element to call a macro?
1606379508
vÍnce
Pro
Sheet Author
I don't think so.  While action buttons can be used to trigger sheetworker events, sheet workers cannot actually make a roll. ;-(
Thanks. Hmm...unless i'm misunderstanding - which I probably am XD. I don't want the sheet worker to trigger a roll (calling a roll template etc...) i want the sheet worker to call an existing macro on a character sheet %{character|macro} etc... I guess the engine that handles both is the same?
1606383666

Edited 1606384137
vÍnce
Pro
Sheet Author
Sheetworkers can only manipulate attribute data.  If a macro is stored as an attribute, then yes, sheetworkers can do something with that attribute data when triggered by an action button.  Example; when a given action button is pushed, change the value (ie macro) of a sheet roll button. Some sheets that use dice pools do this. What are wanting to do exactly?
Thanks! That sounds close to what I've been doing. This is the sort of thing I've been trying. I store the macro name in the value of a select option. And then I've been trying to call a macro from the roll button. - with no success. <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: - Instead, I was thinking i could have an action button instead, that calls a sheet worker, that could use the attr Slot1, which has the macro name stored.
1606423117

Edited 1606423380
vÍnce
Pro
Sheet Author
OK, I see what you want. Try this <input type="hidden" name="attr_call_macro" value="%{" /> <button type="roll" value="@{call_macro}@{character_name}|@{Slot1}}"></button> basically, make a hidden attribute for the macro command "%"  Include any other characters needed to meet the proper syntax to call an existing macro by name from chat. ie {, |, and }. <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> <!-- example format to call a macro: %{bob|GuidingLightAvana} --> <input type="hidden" name="attr_call_macro" value="%{" /> <button class="sheet-skill-button" type="roll" value=" @{call_macro}@{character_name}|@{Slot1}} " title="."><span class="sheet-die">i</span></button> This assumes you have created the ability macros as listed in your select.  If these are "global" macros, you wouldn't need to include the character_name substitution.  This could also be modified accordingly if you are using a macro mule character.  Cheers
That's amazing thanks! Works perfectly! Thank you for taking the time to help me.
1606425772
vÍnce
Pro
Sheet Author
You're welcome. ;-)