Skip to content

Instantly share code, notes, and snippets.

View teddy-dev's full-sized avatar

Teddy teddy-dev

View GitHub Profile
@teddy-dev
teddy-dev / macro.js
Created June 29, 2022 15:17
FoundryVTT - End Turn
if (!game.combat)
return ui.notifications.error("You can only do this during combat.");
if (!game.combat.combatant.isOwner && !game.user.isGM)
return ui.notifications.error("You can only do this on your turn.");
return game.combat.nextTurn();
@teddy-dev
teddy-dev / macro.js
Created June 28, 2022 18:03
FoundryVTT - SW5E: Lightsaber (Luminous) Color Selector
const COLORS = {
blue: "#2f67f8",
red: "#ea202d",
green: "#55b54d",
yellow: "#feca30",
purple: "#6f318f",
white: "#ffffff",
orange: "#f1702e"
};
@teddy-dev
teddy-dev / date.js
Last active August 20, 2020 02:10
Wallpaper Engine: Display Date
'use strict';
export function update(value) {
const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
let time = new Date();
return `${months[time.getMonth()]} ${getOrdinalNum(time.getDate())}, ${time.getFullYear()}`;
}
// public domain
function getOrdinalNum(n) {
@teddy-dev
teddy-dev / macro.js
Created August 3, 2020 23:03
FoundryVTT - Offer short or long rest to all player controlled tokens
let type = 0;
let choice = new Dialog({
title: 'Offer Rest',
content: '<p>Do you want to offer all players a short or long rest?</p>',
buttons: {
short: {
label: 'Short',
callback: () => {
type = 1;
}
@teddy-dev
teddy-dev / macro.js
Created August 3, 2020 23:02
FoundryVTT - Link all (represented actor only) scene tokens to actor by name
let tokens = canvas.tokens.children[0].children;
for (let i = 0; i < tokens.length; i++) {
let token = tokens[i];
let actor = game.actors.find(actor => actor.name === token.name);
if (actor) {
token.update({actorId: actor.id, actorLink: false});
}
}
@teddy-dev
teddy-dev / macro.js
Last active January 26, 2023 01:19
FoundryVTT Token Light Selector
let dialogEditor = new Dialog({
title: `Token Light Picker`,
content: `What is the distance of the light source to set on selected token?`,
buttons: {
none: {
label: `None`,
callback: () => {
token.document.update({"dimLight": 0, "brightLight": 0, "lightAngle": 360,});
}
},