This is a collection of macro notes that I've built up. A lot of it is going to be random, so I apologize in advance if it seems a little unorganized.
@abilities.con.mod
game.Gametime.queue();
shows the queue
game.Gametime.clearTimeout(1581598672547);
clears a specific object(s) at a certain timestamp
game.Gametime.flushQueue();
removes the whole queue
@classes.sorcerer.level
@abilities.dex.mod
let doStuff = game.macros.getName("Do Stuff");
// when you need to execute it
doStuff.execute(arg1, arg2, etc.);
game.users.entities.filter(u => u.isGM).map(u => u._id);
args[0]
canvas.tokens.controlled[0]
gets you 5e token-specific data
canvas.tokens.controlled[0].data
gets you TokenData
canvas.tokens.controlled[0].actor.data
gets you ActorData
canvas.tokens.controlled[0].actor.data.data
gets you actor-specific data like attributes, abilities, etc.
let result = await game.macros.getName("yourMacroName").execute();
game.scenes.active
{speaker, actor, token, character, args, scene}
speaker
: ChatSpeakerData
actor
: Actor5e (D&D5e-specific)
token
: Token5e (D&D5e-specific)
character
: Actor5e (D&D5e-specific)
args
: any[] (specified by user and/or calling macro)
scene
: Scene
Hooks.call('ForienQuestLog.Open.QuestLog');
ui.notifications.info(message)
let update = canvas.tokens.controlled.map(token => ({_id: token.id, anyTokenFieldsYouWantToEdit: 0}));
await canvas.scene.updateEmbeddedDocuments("Token", update);
await token.document.update(
{
lightAnimation: {type: "none"},
dimLight: 0,
brightLight: 0,
lightColor: "",
lightAlpha: 1
});
token.update({"elevation": args[0]});
ChatMessage.create({content: message, whisper: *collection of users*});