How to use the "World Scripter" module?


I’m trying to do some custom elements for my Forge game, and was directed to the World Scripter module so that I might be able to create a custom script to put in. However after installing and activating it I’m left with an empty compendium folder and no other information.

I created a macro with the following:

Hooks.on("ready", () => ui.notifications.notify("Welcome to the World!"));

(which I took from World Scripts | Foundry VTT Community Wiki) and dragged it into the compendium window, where it now appears, but it doesn’t appear to actually do anything even after a restart of the server.

Could someone possibly point me in the direction of how I add scripts to this and check if its working? Thanks.

Heya :wave:

It’s likely that the module is fully initialized after the ready hook has already been called.

You are doing it right, I believe :slight_smile: Check this screenshot for another example.
You can use a different hook, like sightRefresh to test.

Alternative to world scripter

As an edit to this post, another way to add world scripts (if you need them to run very early on in Foundry’s startup) is to export the world (How to Export Worlds and Compendium Modules from The Forge), edit its world.json file and add your world scripts locally, and then re-import the world with the Import Wizard.

Heya - yeah I saw I might be able to do the export/import, but wanted to see if I could do it without that, as I’ll likely need to continually tweak the script, namely as I want to move some elements on certain scenes to work with the Falemos plugin.

I’ll give that a try, thank you :slight_smile: