Package Description

Allows users to define custom Dynamic Entity Links that call macros. This module makes it possible to convert a single-use macro (e.g. activating a specific scene) into a reusable macro (e.g. activating any scene, given an id), that is still easily referenced using the Dynamic Entity Link system: @MyResuableMacro[id].

Included DML-Ready Macros

  • ActivateScene - activate any scene from a journal using @ActivateScene[sceneId]
  • PlayPlaylist - play any playlist using @PlayPlaylist[playlistId]
  • PlayOnlyPlaylist - stop all playlists and then play a given playlist using @PlayOnlyPlaylist[playlistId]

Example Usage

A single use macro that activates a scene might look like this:

// Normal Macro with id 'macroId' 
const scene = game.scenes.get('sceneId');
if(scene !== null) {
  scene.activate();
}

And get used in a journal entry like this:

// Normal Usage
@Macro['macroId']{Activate Scene with id "sceneId"}

 

With a small change, this macro becomes callable with Dynamic Macro Links.

// Dynamic Macro Link
const [id] = args; //args is a special environment variable available to macros called by DML 
const scene = game.scenes.get(id);
if(scene !== null) {
  scene.activate();
}

After we add the above macro to the Dynamic Macro Link settings, we can use it for multiple scenes:

// Dynamic Macro Links with name "ActivateScene"
@ActivateScene['sceneId']{Activate Scene with id "sceneId"}
@ActivateScene['anotherSceneId']{Activate Scene with id "anotherSceneId"}

Tagged Categories

  1. Tools and Controls
  2. Journals and Notes

Available Versions

  1. Version v0.1.2