Skip to content

JB2A & 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.

How to Troubleshoot

Here are a few best practices for things to check or try when you’re having an issue:

If you are new to this, make sure to read our “Prerequisites” and “Understanding Automation” sections first.

  1. Non-Chromium browsers (such as Firefox, Opera, Safari) are known to cause issues. Use a Chromium based browser like Chrome or Edge.

  2. Sometimes, refreshing the page, re-starting the server or re-installing the module with the issue can be enough. It’s worth a try.

    • Windows: F5 to refresh or CTRL + F5 to refresh and clear the cache.
    • MacOS: CMD + R to refresh or SHIFT + CTRL + R to refresh and clear the cache.
  3. Check for any updates that might be available for the module you are having issues with and all of its dependencies. It’s usually safe to update your modules.

  4. Have you forgotten to enable the module in the world?

  5. Is there an error in the console when you trigger the macro or item? Errors are red, yellow ones are deprecation warnings and are safe for you to ignore.

    To open the console in FoundryVTT:

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

    If you do have an error, please include a screenshot when reporting it.

  6. Make sure you try with only the required modules activated. It’s often easier to do so in a fresh new world.

    You would need at least these modules activated:

    • JB2A module, Free or Patreon
    • Sequencer
    • Socketlib (Sequencer dependency)
    • Any other module required for your automation
  7. The Github page for each module is, almost always, the best source of information about the module. That’s where the information is most up to date and you can see when the last update to the module occured.

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