Custom Sheet Macro Attributes
Join the Closed Beta
The Beacon SDK is currently in closed Beta. Please complete the form to sign up for the closed beta.
Join to get access to the Beacon SDK, the community sheet repo for Beacon sheet, the community sheet developers in discord, and the new sheet developer Roll20 permissions.
When utilizing Macroswithin the Roll20 Tabletop or Roll20 Characters (both refered to as host throughout this page), there are instances where a older Custom Sheet macro might need to be employed for a Beacon sheet.
This scenario commonly arises when transitioning from an existing older Custom Sheet to a Beacon sheet. During such transitions, it’s possible that the attributes or roll templates called from the older Custom Sheet macros may not align with the structure of attributes or the lack of roll templates in the Beacon Sheet.
convertLegacyMacroAttributes
The convertLegacyMacroAttributes
method allows us to determine the mapping strategy for older Custom Sheet attributes to the new Beacon Sheet.
This method is defined during the initial SDK initialization process and is invoked by the host when it attempts to parse a macro and encounters a failure in locating an attribute’s value during an macro’s execution.
Advanced sheet actions typically will first search through the defined computed properties before resorting to the convertLegacyMacroAttributes
method as a fallback.
The method’s purpose is to return a value that will be substituted in the macro. However, it grants us the autonomy to devise the preferred approach for handling older Custom Sheet attribute values.
Returning a null
value will display the following error message to the user: Unable to find attribute with the name ${attribute}
handleLegacyRollTemplates
Since Beacon sheets no longer require or use roll templates as previously needed in older custom sheets, there will be times where a older Custom Sheet macro might make include a reference to a older Custom Sheet roll template. We can use the handleLegacyRollTemplates
to determine how to handle these cases.
The properites object will also include a plainText key for roll template arguments not inside the curly brace syntax.