Using this Foundry VTT module, you can mark macros as active giving them a coloured border and an alternative icon.
Dimming the inactive macros is configurable in the module settings.
This module is 100% compatible with @Norc's amazing Custom Hotbar!
The primary way to use this module, is to set a condition or trigger when the marker is activated. This is done in the macro configuration. This dialog now has an extra tab named "marker".
The script will execute on any change to the character sheet, when the hotbar renders (e.g. on page changes) and when you select a token.
When the script returns true
, the marker will be activated. When it returns false
, it will be deactivated.
Like in the actual macro, you can use the this
(current macro), token
(selected token), actor
(actor of selected token) and character
(the user's character) variables.
Example: The following trigger activates the marker when a) a token is selected; and b) the strength modifier is less than 0.
if (!token)
return false;
return actor.data.data.abilities.str.mod < 0;
Alternatively, you can return a colour to dynamically colour your marker:
if (!token)
return false; // marker deactivated
const hp = actor.data.data.attributes.hp.value;
const max = actor.data.data.attributes.hp.max;
const ratio = (hp / max) * 100;
if (ratio < 33) return "red"; // active marker with a red colour
if (ratio < 67) return "#FF8000"; // active marker with an yellow colour
return false; // marker deactivated
If using a trigger like the one above is not an option, you can use flags instead.
You can toggle the state on one of three entities:
- Macro
- Token (or linked actor)
- User
NB: Flag-based toggles should only be used inside the actual macro, not inside the marker configuratio!
Toggling the state on the macro will make it visible for every user, irregardless of the token they have selected.
MacroMarker.toggle(macro);
NB:
macro
is a variable pointing to a macro. In general you can usethis
instead inside your own macros or you can toggle another macro by finding it ingame.macros
. For examplelet macro = game.macros.getName('Toggle Rage');
. The script macro then becomes this to toggle itself:MacroMarker.toggle(this);Or this to toggle another macro:
let macro = game.macros.getName('Toggle Rage'); MacroMarker.toggle(macro);
Toggling the state on the token will make it visible for whoever controls the token. If the token is linked, the state will be synchronized across all other linked tokens of the same actor.
let token = canvas.tokens.controlled[0];
if (token)
MacroMarker.toggle(macro, { entity: token });
Toggling the state on the user will make it visible for only that user irregardless of the token they have selected.
let user = game.user;
MacroMarker.toggle(macro, { entity: user });
Alternatively, you can manually activate and deactivate it, using the same function signature as the toggle
function.
NB: Manual toggles should only be used inside the actual macro, not inside the marker configuratio!
MacroMarker.activate(macro);
MacroMarker.deactivate(macro);
MacroMarker.activate(macro, { entity: user });
MacroMarker.deactivate(macro, { entity: token });
Finally, you can also check the state:
MacroMarker.isActive(macro);
MacroMarker.isActive(macro, { entity: token });
MacroMarker.isActive(macro, { entity: user });
You can configure an alternative tooltip, icon and colour when editing the macro.
You can find more examples in the included compendium Macro Marker Examples.