Skip to content

Instantly share code, notes, and snippets.

This version was deprecated, but I am leaving the gist to direct people to the new copy, which is here:
https://github.com/keithcurtis1/token-actions
@keithcurtis1
keithcurtis1 / Mass Sight
Created May 25, 2020 16:51
This Roll20 script sets the has sight setting for mass tokens. Use with caution. Command is: !set-has-sight --[true|false] --[npc|pc|all]
on('ready',()=>{
const playerCanControl = (obj, playerid='any') => {
const playerInControlledByList = (list, playerid) => list.includes('all') || list.includes(playerid) || ('any'===playerid && list.length);
let players = obj.get('controlledby')
.split(/,/)
.filter(s=>s.length);
if(playerInControlledByList(players,playerid)){
return true;
!chatmenu @{selected|character_id} {template:npcaction}{{rname=@{selected|character_name}}}{{name=Put non-spell invocations in here}}{{description=CHATMENU}} --separator: | --title:Cantrips — *Save DC @{selected|spell_save_dc}* --repeating_spell-cantrip|spellname|spell|spellsource=Mystic --title:Lvl-1 *(@{selected|class_resource}/@{selected|class_resource|max})* --repeating_spell-1|spellname|spell|spellsource=slot --title:Lvl 2 --repeating_spell-2|spellname|spell|spellsource=slot --title:Lvl 3 --repeating_spell-3|spellname|spell|spellsource=slot --title:Lvl 4 --repeating_spell-4|spellname|spell|spellsource=slot --title:Lvl 5 --repeating_spell-5|spellname|spell|spellsource=slot --title:Invocation-1 --repeating_spell-1|spellname|spell|spellsource=invocation --title:Invocation-2 --repeating_spell-2|spellname|spell|spellsource=invocation --title:Invocation-3 --repeating_spell-3|spellname|spell|spellsource=invocation --title:Invocation-4 --repeating_spell-4|spellname|spell|spellsource=invocation --title:Invoca
@keithcurtis1
keithcurtis1 / Spell Reporter - Using InsertArg
Created September 9, 2020 17:20
This macro creates a spell list for the selected character. The list is presented as a whispered menu, and clicking on any spell will output a spellcard to chat, useful for presenting details of a spell during the game, regardless of the spells settings, and without triggering athe usage of a spell slot. The macro requires the user to install th…
!ia --menu --row#spellreport --^^spellreport#getrow{{!!t#Cantrips !!c#ffffff !!s#getrepeating{{!!c#@{selected|character_name} !!d# |  !!s#spell-cantrip !!sfxn#spellname !!op#bC !!emptyok !!sfxa#spellname !!sfxlist#spellschool School:|spellcastingtime Casting Time:|spellrange Range:|spelltarget Target:|spellcomp_materials Components:|spellduration Duration:|spelldescription Description: (fw) !!frmt#o+}}}} --^^spellreport#getrow{{!!t#Level 1 !!f#.9 !!s#getrepeating{{!!c#@{selected|character_name} !!d# |  !!s#spell-1 !!sfxn#spellname !!op#bC !!emptyok !!sfxa#spellname !!sfxlist#spellschool School:|spellcastingtime Casting Time:|spellrange Range:|spelltarget Target:|spellcomp_materials Components:|spellduration Duration:|spelldescription Description: (fw) !!frmt#o+}}}} --^^spellreport#getrow{{!!t#Level 2 !!c#ffffff !!s#getrepeating{{!!c#@{selected|character_name} !!d# |  !!s#spell-2 !!sfxn#spellname !!op#bC !!emptyok !!sfxa#spellname !!sfxlist#spellschool School:|spellcastingtime
@keithcurtis1
keithcurtis1 / reporter.js
Last active January 4, 2022 06:58
Reporter
// Reporter
// Last Updated: 2021-03-26
// A script to report token and character calls in a list.
// Syntax is !report --[t|token_attribute] [c|character_attribute]... ---macro code for each character
on('ready', () => {
const version = '1.0.1'; //verion number set here
log('-=> Reporter v' + version + ' <=-'); //Logs version number to console
sendChat('Reporter', '/w gm Ready');
@keithcurtis1
keithcurtis1 / dialog.js
Created March 29, 2021 15:03
Creates dialog boxes with token images for Roll20 *!dialog [token_id] --[message]*
on('ready',()=>{
on('chat:message',(msg)=>{
if('api' === msg.type && /^!dialog/i.test(msg.content)){
let p = getObj('player',msg.playerid);
let theMessage = "";
const openBox = "<div style='border: 0px none; margin-top: 10px; border-radius: 35px 6px 6px 6px; box-shadow: 2px 2px 4px 2px #000; min-height:60px; display: block; padding:5px; text-align: left; white-space: pre-wrap;'>";
const closeBox = "</div>";
const buttonStyle = "'background-color: transparent; align:right; font-size: 0.8em; line-height:1.2; font-family: sans-serif; font-style: normal; font-weight: normal; padding: 0px;color: #ce0f69;display: inline-block;border: none; !important'";
function imageFormat(imgsrc){
@keithcurtis1
keithcurtis1 / faces.js
Last active October 7, 2022 07:04
Script to change token faces on Roll20
var API_Meta = API_Meta || {};
API_Meta.Faces = {
offset: Number.MAX_SAFE_INTEGER,
lineCount: -1
}; {
try {
throw new Error('');
} catch (e) {
API_Meta.Faces.offset = (parseInt(e.stack.split(/\n/)[1].replace(/^.*:(\d+):.*$/, '$1'), 10) - (4));
}
@keithcurtis1
keithcurtis1 / Roll20 Minor Forum Tweaks
Created August 4, 2022 18:17
Quick forum tweaks for Roll20
/* categories */
.chosen-choices {
position: absolute !important;
max-height: 27px;
top: -14px;
-webkit-transition: all .25s linear;
}
.chosen-choices:hover, .chosen-choices:active {
max-height: inherit;
-webkit-transition: all .25s linear;
on("ready", function () {
const theGM = findObjs({
type: 'player'
})
.find(o => playerIsGM(o.id));
on("change:campaign:playerpageid", function () {
setTimeout(function () {
pingPlayerToken();
},
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