Package Description

Using this Foundry VTT module, you can mark macros as active giving them a coloured border and an alternative icon.

 

Experiencing issues? Ping me on the Foundry Discord Server: Stan#1549

 

 

Dimming the inactive macros is configurable in the module settings.

This module is 100% compatible with Custom Hotbar and Token Hotbar!

 

Coloured active macros


 

Alternative icon and tooltip


 

Optional animated border


 

Automated toggles

 

Usage

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".

 

Trigger-based toggles

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;

If using a trigger like the one above is not an option, you can use flags instead.

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.

 

Flag-based toggles

You can toggle the state on one of three entities:

  1. Macro
  2. Token (or linked actor)
  3. User

NB: Flag-based toggles should only be used inside the actual macro, not inside the marker configuration!

 

Macro

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 use this instead inside your own macros or you can toggle another macro by finding it in game.macros. For example let 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);

 

Token

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 });

 

User

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 });

 

Manual toggles

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 configuration!

MacroMarker.activate(macro);
MacroMarker.deactivate(macro);

MacroMarker.activate(macro, { entity: user });
MacroMarker.deactivate(macro, { entity: token });

Checking the state

Finally, you can also check the state:

MacroMarker.isActive(macro);
MacroMarker.isActive(macro, { entity: token });
MacroMarker.isActive(macro, { entity: user });

 

Marker configuration

You can configure an alternative tooltip, icon and colour when editing the macro.

 

More examples

You can find more examples in the included compendium Macro Marker Examples.



Tagged Categories

  1. Automation Enhancers
  2. Visual Effects

Available Versions

  1. Version 1.0.6