Skip to content

FoundryVTT

Advanced notions and guidelines using our content on FoundryVTT

Best Practices

Console

When something goes wrong, opening the console should be your first impulse.

  • Windows: Press F12
  • MacOS: Press Option + CMD + J

You can safely ignore the yellow deprecation warnings. They’re not breaking anything, just letting the developers know that they’ll have to modify some of their code eventually. The red error messages are what we’re looking for. Most of the time, they’ll give you information about which module is implicated in the error.

If you’re overwhelmed with the huge amount of logs, you can clear the console by pressing a button like this one. Here it’s on Chrome but there will be a similar one on other browsers:

console clear image

Then recreate the issue and check if a red message appears.

Advanced

Macros

You need at least a basic understanding of Javascript, knowing what variables are, how to create and manipulate arrays, objects…etc. There are plenty of different beginner courses online for free, here’s an example below.

Javascript Codecademy Course

Then, there are some key concepts for FoundryVTT to understand. Looking through the #macro-polo channel on the main FoundryVTT discord server is really helpful and there’s almost always someone around to answer any questions you may have.

Join the FoundryVTT Discord

Hooks and Worldscripts

Now that you know a bit more about Javascript, macros and FoundryVTT’s API, you may want to look into hooks.

What is a hook and why would you need it?

In simple words, everytime something happens in your game, a hook is triggered. It can be from you hovering your mouse on a Token, using a skill, opening a character sheet, the list goes on and on. FoundryVTT provides hooks by default and every system and module can implement its own hooks. To interact with these hooks, retrieving the data and doing something with it, it’s usually better to use a world script. If you use a macro, you’d have to execute it every time you load or refresh your game.

It’s a vast subject and behond the scope of this website. However, here is some documentation on World scripts

Modules

The next step is to create a module. A common way to share your compendia and world scripts across different worlds for example is by creating a small module that you can activate in different worlds!

Module Development Article