Register

Advanced Macros

A Module for Foundry Virtual Tabletop

Author: Matheus Clemente Project Source: Project URL Version 10 Last Updated 2 weeks, 3 days ago
Enhance the utility of your macros.

Features

Usage

Check out the Macros compendium for some useful macros that showcase the advanced macros system as well as provide additional features.

 

In the case of chat macros, you can now use handlebars templating to render your chat text using common helpers, or use it along with the macro helper to call other macros, for example {{macro "name of my macro" actor 3 "a text argument"}}

 

In the case of script macros, you can now use a return statement for the early return paradigm, but also to return a string which can then be used in chat macros. You will also be able to receive arguments via an array named args.

Do note that if you create an async macro, it cannot be used to return text in a chat macro when using the {{macro}} helper. It will still be executed if used, but will be considered to have returned an empty string. If you want to use an async macro that prints its results to chat, read further for the use of recursive async chat commands.

 

Besides those two enhancements to macros, you can now also create a temporary chat macro with handlebars templating directly from the chat entry, by entering text in the chat that includes the handlebars mustache characters {{ }}. You will also be able to call your macro directly from chat with the / prefix. As an example, you can send in the chat /my-macro-name argument1 argument2 argument3. If your macro name has spaces in it, you can call it with /"My macro name" "argument one" 100 for example. You can also call multiple macros by writing them one per line.

 

In addition, you can now recursively call macros, so you could call a script or chat macro which returns a /macro-name text for it to call the macros recursively.

Notes

If you're using this module just to call simple script macros without arguments directly from chat, consider the Core Foundry /macro macro-name command.

Categories

Available Versions

  1. Version 1.6

    Compatible Foundry Versions: 0.8.5 - 0.8.6 Installation Link: Manifest URL Update Notes: Read Notes
  2. Version 1.15

    Compatible Foundry Versions: 9 - 9 Installation Link: Manifest URL Update Notes: Read Notes
  3. Version 1.18.1

    Compatible Foundry Versions: 10 - 10 Installation Link: Manifest URL Update Notes: Read Notes
  4. Version 1.19

    Compatible Foundry Versions: 10 - 10 Installation Link: Manifest URL Update Notes: Read Notes