Skip to content

Instantly share code, notes, and snippets.

@keithcurtis1
keithcurtis1 / GroupcheckGray.js
Created September 10, 2024 21:11
Grey mode for Groupcheck for Roll20
// GroupCheck version 1.12
// Last Updated: 2019-08-14
// A script to roll checks for many tokens at once with one command.
/* global state, getObj, getAttrByName, on, log, sendChat, playerIsGM, _ */
const GroupCheck = (() => {
"use strict";
const version = "1.12",
stateVersion = 7,
dataVersion = 7,
on("change:graphic", function(obj, prev) {
let tokenID = obj.get("id");
let page = getObj("page", Campaign().get("playerpageid"));
if (typeof checkLightLevel !== "undefined" && page.get("dynamic_lighting_enabled")) {
if (prev.left !== obj.get("left") || prev.top !== obj.get("top")) {
function containsIllumination(illumination, obj) {
return illumination.some(item => obj.name.includes(item));
}
function updateIllumination(obj, lightLevel, dimLight, darkness) {
let newName;
@keithcurtis1
keithcurtis1 / Hands Up Modified
Created February 3, 2024 22:29
Styles the text notification in the chat
var HandsUp = (() => {
'use strict';
/**
* The hand-raising state for a player.
* @typedef {object} HandState
* @property {number} intervalId
* @property {string} origColor
*/
@keithcurtis1
keithcurtis1 / gist:29d0d608996630d0e49252b950fac390
Created January 31, 2024 22:08
Fix Journal Command Buttons
on('ready',()=>{
const JournalCommandDecoder = (t) => {
const fixStart = t => t.replace(/^"https:\/\/app.roll20.net\/editor\/%60/,'"`');
const percentOut = t => t.replace(/%{/g,'::PERCENT_OPEN_CURLY::');
const percentIn = t => t.replace(/::PERCENT_OPEN_CURLY::/g,'%{');
return percentIn(decodeURIComponent(percentOut(fixStart(t))));
};
var API_Meta = API_Meta || {};
API_Meta.dltool = {
offset: Number.MAX_SAFE_INTEGER,
lineCount: -1
}; {
try {
throw new Error('');
} catch (e) {
API_Meta.dltool.offset = (parseInt(e.stack.split(/\n/)[1].replace(/^.*:(\d+):.*$/, '$1'), 10) - (7));
}
var API_Meta = API_Meta || {}; //eslint-disable-line no-var
API_Meta.Condefinition = {
offset: Number.MAX_SAFE_INTEGER,
lineCount: -1
}; {
try {
throw new Error('');
} catch (e) {
API_Meta.Condefinition.offset = (parseInt(e.stack.split(/\n/)[1].replace(/^.*:(\d+):.*$/, '$1'), 10) - (7));
}
@keithcurtis1
keithcurtis1 / Supernotes 020b
Last active December 7, 2022 02:32
Supernotes with custom templates
var API_Meta = API_Meta || {};
API_Meta.Supernotes = {
offset: Number.MAX_SAFE_INTEGER,
lineCount: -1
}; {
try {
throw new Error('');
} catch (e) {
API_Meta.Supernotes.offset = (parseInt(e.stack.split(/\n/)[1].replace(/^.*:(\d+):.*$/, '$1'), 10) - (4));
}
tell application "Adobe InDesign 2022"
--return selection
set tableexport to ""
set theTables to every table of every text frame of front document
--return item 1 of theTables
set theParent to parent of item 2 of theTables
set bob to contents of row 2 of item 2 of theTables
var API_Meta = API_Meta || {};
API_Meta.Pingbuddy = { offset: Number.MAX_SAFE_INTEGER, lineCount: -1 };
{
try { throw new Error(''); } catch (e) { API_Meta.Pingbuddy.offset = (parseInt(e.stack.split(/\n/)[1].replace(/^.*:(\d+):.*$/, '$1'), 10) - (4)); }
}
/*########################
PingBuddy by Keith Curtis, including code adapted from Nick Olivo
Forum thread: https://app.roll20.net/forum/post/11095028/script-ping-buddy
Script repo: https://gist.github.com/keithcurtis1/536c5e575e4ef6ba40a519eca17b392a
on("ready", function () {
const theGM = findObjs({
type: 'player'
})
.find(o => playerIsGM(o.id));
on("change:campaign:playerpageid", function () {
setTimeout(function () {
pingPlayerToken();
},