Latest version 0.1
Released 1 month ago
Initial release. Testers and feedback wanted! Please expect changes.
This plugin allows you to create dice macros in any entity, and potentially transclude them into other pages (or even sidebars!). Dice rolling logic is handled by the RPG Dice Roller library – please follow the link for instructions and examples of syntax and available features.
Transcluding a macro is very easy. Simply create a mention to the macro’s entity using advanced mention syntax (which you can enable in your profile settings under Appearance), then add the field:attributes
property like so: [note:12345|field:attributes]
. Instead of linking to the entity, the actual dice roller will be rendered in an iframe.
I recommend adding the following CSS rule to your campaign styles to keep the dice roller iframe only as big as needed. This will apply to any entity tagged "Dice Macro" and transcluded with the field:attributes
syntax. Unfortunately, this cannot be applied directly via the plugin since its CSS is only loaded inside the iframe, and therefore cannot affect the iframe’s outer dimensions.
/* Dice Macro transclusion iframe */ .entity-attributes-render[data-entity-tags~="dicemacro"] { height: 120px; max-width: 300px; }
If you use different kinds of macros and tag them accordingly, you can even create different rules to have custom dimensions based on other tags as well.
Transclusion also works in attribute values, so you can pin a dice roller to any entity’s sidebar using the same method! Simply create a standard attribute, put in the mention with the same syntax as above and click the pin icon to pin the attribute. To account for the much smaller area, you may want to use macros specifically made for this purpose, without a title (the attribute’s name can fulfill that role) and with Disable Input checked to keep only the button and result visible.
The dice roller’s main container includes the data-entity-tags
attribute, allowing you to style various rollers based on their entity’s tags. For example, you could have "Attack Macro" and "Damage Macro" tags on various macros and style rollers differently for each category. These tags are given in slug form, as in other parts of Kanka. For example, to give a much bigger title to those Attack Macros:
.rpg-dice-roller[data-entity-tags~="attackmacro"] h4 { font-size: 20px }
RPG Dice Roller is shared under the MIT license.
Want to show appreciation for my plugins or request one-on-one CSS help? I accept tips on Ko-fi (no account needed):
Released 1 month ago
Initial release. Testers and feedback wanted! Please expect changes.