Skip to content
Cefas Sathler edited this page Jan 17, 2023 · 7 revisions

List all active modules

let mods = '';
game.modules.forEach(m => {
  let a = m.active ? 'Enabled' : 'Disabled';
  mods = mods.concat(`${m.id}: ${a}\n`);
});

let d = new Dialog({
  title: `Enabled Mods`,
  content: `<textarea style="height: 500px;" type="text" id="modslist" name="modslist">${mods}</textarea>`,
  buttons: {
    copy: {
      label: `Copy to clipboard`,
      callback: () => {
        $("#modslist").select();
        document.execCommand('copy');
      }
    },
    close: {
      icon: "<i class='fas fa-tick'></i>",
      label: `Close`
    },
  },
  default: "close",
  close: () => {}
});

d.render(true);

Change scene light to torch

await canvas.lighting.updateAll({"config.animation.type": "torch",  "config.animation.intensity": 2, "config.animation.speed": 5});

Create a Bubble message from table

const draw = await game.tables.getName("Xingamentos").draw({displayChat: false});
const content = draw.results[0].getChatText();
await ChatMessage.create({
  content,
  speaker: ChatMessage.getSpeaker({actor: character})
}, {chatBubble: true});

Change all tokens sizes

tokens = canvas.tokens.controlled
for (let token of tokens) {
token.document.update({scale: 1.2})
}

Change all icons from item inside a folder

const folder = game.folders.get("GV4NnxGM9tf8lz65");
const img = "worlds/japao/assets/japan_18276.png";
const items = game.items.filter(i => i.folder === folder);
const updates = items.map(i => ({_id: i.id, img}));
await Item.updateDocuments(updates);
Clone this wiki locally