Introduction to Foundry Macros & This Guide
How is This Guide Structured?
This guide is NOT meant to be a JavaScript course. Instead, it aims to help you understand how to create and use script macros in Foundry VTT. While basic JavaScript concepts will be covered throughout the guide, explanations will be provided whenever a new concept is introduced.
The guide is practical and includes examples of using JavaScript in Foundry VTT to automate actions. Each article will equip you with the knowledge needed to perform a specific task by the end. The articles are organized by difficulty, introducing various concepts in a logical sequence.
What are Macros?
Macros are a way to automate actions in Foundry VTT. They allow you to create custom scripts that can be triggered by running the macro or activated by other means, such as Modules.
Chat Macros
Chat macros are macros that post a message in chat. These will not be covered in this guide.
Script Macros
Script macros are macros that run a script written in the JavaScript programming language. This will be the focus of this guide.
How to Create a Script Macro
To create a script macro, simply click on an empty hotbar slot and change the macro type to Script. The large text box at the bottom of the window will be used to write the script.
How to Run a Script Macro
To run a script macro, simply click on the macro in the hotbar.